File manager - Edit - /var/www/html/homologBancodetalentos/resources/views/components/navbar.blade.php
Back
@php use App\Http\Services\TalentBank\CandidateService; use App\Http\Services\TalentBank\CompanyService; use App\Models\TalentBank\Candidate; use App\Models\TalentBank\Company; use App\Support\SsoWebSession; $payload = session('sso.user_payload'); $requestUserPayload = request()->get('user'); $talentBankUser = request()->get('talentBankUser'); $ssoName = is_array($payload) ? ($payload['data']['name'] ?? null) : null; $requestUserName = is_array($requestUserPayload) ? data_get($requestUserPayload, 'data.name') : null; $modelUserName = is_object($talentBankUser) ? ($talentBankUser->name ?? $talentBankUser->trading_name ?? null) : null; $displayName = $ssoName ?: $requestUserName ?: $modelUserName ?: __('Minha conta'); $ssoDoc = is_array($payload) ? ($payload['data']['document'] ?? '') : ''; $docDigits = preg_replace('/\D/', '', (string) $ssoDoc); $isCompany = strlen($docDigits) >= 14; $perms = is_array($payload) ? ($payload['data']['permissions']['siati'] ?? []) : []; $canAdmin = is_array($perms) && (in_array('gestao-de-usuarios', $perms, true) || in_array('talent-bank-admin', $perms, true)); $hasSsoSession = SsoWebSession::hasToken(); $candidatePhotoPath = is_object($talentBankUser) ? ($talentBankUser->photo_path ?? null) : null; $companyLogoPath = is_object($talentBankUser) ? ($talentBankUser->logo ?? null) : null; $sessionPhotoPath = session('sso.profile_photo_path'); if ($hasSsoSession && $docDigits !== '' && ! ($talentBankUser instanceof Candidate || $talentBankUser instanceof Company)) { $talentBankUser = $isCompany ? Company::query()->where('cnpj', $docDigits)->first() : Candidate::query()->where('cpf', $docDigits)->first(); } $notificationRecipientType = null; if ($talentBankUser instanceof Company) { $notificationRecipientType = 'company'; } elseif ($talentBankUser instanceof Candidate) { $notificationRecipientType = 'candidate'; } if (! is_string($candidatePhotoPath) || trim($candidatePhotoPath) === '') { if (is_string($sessionPhotoPath) && trim($sessionPhotoPath) !== '') { $candidatePhotoPath = $sessionPhotoPath; } elseif ($hasSsoSession && $docDigits !== '') { if ($isCompany) { $companyFromDocument = $talentBankUser instanceof Company ? $talentBankUser : Company::query() ->select(['id', 'logo']) ->where('cnpj', $docDigits) ->first(); if ($companyFromDocument) { $companyLogoPath = $companyFromDocument->logo; } } else { $candidateFromDocument = $talentBankUser instanceof Candidate ? $talentBankUser : Candidate::query() ->select(['id', 'photo_path']) ->where('cpf', $docDigits) ->first(); if ($candidateFromDocument) { $candidatePhotoPath = $candidateFromDocument->photo_path; } } } } $profilePhotoUrl = null; if (is_string($candidatePhotoPath) && trim($candidatePhotoPath) !== '') { $profilePhotoUrl = CandidateService::photoPublicUrl($candidatePhotoPath); } elseif (is_string($companyLogoPath) && trim($companyLogoPath) !== '') { $profilePhotoUrl = CompanyService::logoPublicUrl($companyLogoPath); } @endphp <section class="fixed-top" id="tb-navbar-auth-state" data-authenticated="{{ $hasSsoSession ? '1' : '0' }}" data-auth-status-url="{{ route('auth.status') }}" data-auth-activity-url="{{ route('auth.activity') }}" data-login-url="{{ route('entrar') }}" > <nav class="navbar navbar-expand-lg navbar-custom shadow p-3"> <div class="container-xxl navbar-shell"> <a class="navbar-brand d-flex align-items-center" href="{{ route('home') }}"> <img src="{{ asset('images/icons/logo2.svg') }}" alt="Logo" class="navbar-logo"> </a> @if ($hasSsoSession) <div class="navbar-toolbar d-flex align-items-center"> @if ($notificationRecipientType) @include('components.notifications-bell', ['recipientType' => $notificationRecipientType]) @endif <div class="dropdown"> <button class="btn btn-nav-perfil dropdown-toggle d-flex align-items-center gap-2" type="button" data-bs-toggle="dropdown" aria-expanded="false"> @if ($profilePhotoUrl) <img src="{{ $profilePhotoUrl }}" alt="{{ $displayName }}" class="nav-avatar-img"> @else <div class="nav-avatar">{{ strtoupper(\Illuminate\Support\Str::substr($displayName, 0, 1)) }}</div> @endif <span class="nav-username d-none d-lg-inline">{{ $displayName }}</span> </button> <ul class="dropdown-menu dropdown-menu-end"> <li> <span class="dropdown-item-text"> <small class="text-muted">Logado como</small><br> <strong>{{ $isCompany ? 'Empresa' : 'Candidato' }}</strong> </span> </li> <li><hr class="dropdown-divider"></li> @if ($canAdmin) <li> <a class="dropdown-item" href="{{ route('talent-bank.admin.candidates') }}"> <i class="bi bi-shield-check me-2"></i> Admin BT </a> </li> @endif @if ($isCompany) <li> <a class="dropdown-item" href="{{ route('talent-bank.company.dashboard') }}"> <i class="bi bi-building me-2"></i> Área da empresa </a> </li> <li> <a class="dropdown-item" href="{{ route('talent-bank.company.notifications.index') }}"> <i class="bi bi-bell me-2"></i> Notificações </a> </li> @else <li> <a class="dropdown-item" href="{{ route('talent-bank.candidate.profile') }}"> <i class="bi bi-person me-2"></i> Meu perfil </a> </li> <li> <a class="dropdown-item" href="{{ route('talent-bank.candidate.curriculum') }}"> <i class="bi bi-file-earmark-text me-2"></i> Meu currículo </a> </li> <li> <a class="dropdown-item" href="{{ route('talent-bank.candidate.notifications.index') }}"> <i class="bi bi-bell me-2"></i> Notificações </a> </li> @endif <li><hr class="dropdown-divider"></li> <li> <button type="button" class="dropdown-item text-danger" data-bs-toggle="modal" data-bs-target="#modalLogout" > <i class="bi bi-box-arrow-right me-2"></i> Sair </button> </li> </ul> </div> </div> @endif <button class="navbar-toggler {{ $hasSsoSession ? 'ms-2' : 'ms-auto' }}" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="collapse navbar-collapse justify-content-end" id="navbarNav"> <ul class="navbar-nav mx-auto text-center"> <li class="nav-item"> <a class="nav-link {{ request()->routeIs('home') ? 'active' : '' }}" href="{{ route('home') }}" @if (request()->routeIs('home')) aria-current="page" @endif> HOME </a> </li> <li class="nav-item"> <a class="nav-link {{ request()->routeIs('sobre') ? 'active' : '' }}" href="{{ route('sobre') }}" @if (request()->routeIs('sobre')) aria-current="page" @endif> SOBRE </a> </li> <li class="nav-item"> <a class="nav-link {{ request()->routeIs('vagas') ? 'active' : '' }}" href="{{ route('vagas') }}" @if (request()->routeIs('vagas')) aria-current="page" @endif> VAGAS </a> </li> <li class="nav-item"> <a class="nav-link {{ request()->routeIs('empresas') ? 'active' : '' }}" href="{{ route('empresas') }}" @if (request()->routeIs('empresas')) aria-current="page" @endif> EMPRESAS </a> </li> <li class="nav-item"> <a class="nav-link {{ request()->routeIs('fale-conosco') ? 'active' : '' }}" href="{{ route('fale-conosco') }}" @if (request()->routeIs('fale-conosco')) aria-current="page" @endif> FALE CONOSCO </a> </li> </ul> @unless ($hasSsoSession) <div class="d-flex flex-column flex-lg-row align-items-center navbar-actions"> <a href="{{ route('entrar') }}" class="btn btn-nav-angra"> <i class="bi bi-person-badge-fill" aria-hidden="true"></i> {{ __('Acessar com a Conta Angra') }} </a> </div> @endunless </div> </div> </nav> </section> <script> (function () { var nav = document.querySelector('.navbar-custom'); if (!nav) return; function onScroll() { nav.classList.toggle('navbar-scrolled', window.scrollY > 10); } window.addEventListener('scroll', onScroll, { passive: true }); onScroll(); }()); </script>
| ver. 1.4 |
Github
|
.
| PHP 8.3.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings