{{-- App shell of the #2957 reskin (DESIGN.md "Navigation and app shell"). Migrated customer views @extends('layouts.nuhet') and fill @section('page'); optional: @section('_pageTitle'), @section('pagename') (top bar text, defaults to the title), @section('banners'), @push('styles'), @push('scripts'). No Bootstrap, Font Awesome, jQuery or main.js here: a page that still needs them pushes them itself. js/agreement.js (Vue: Agreement) loads on every page; the old floating Feedback tab is not rendered here (the rail foot opens nh-support). Unmigrated and admin views keep extending the old app.blade.php. --}} @php $nhUser = Auth::user(); $nhAdminPage = Route::is('admin.*') && ($nhUser->hasRole('admin') || $nhUser->hasRole('superadmin')); $nhCompany = $nhUser->company; $nhUnreadNotices = count($nhCompany->unreadNotices()); $nhOverride = ! is_null($nhUser->override_company_id); $nhRemovalPending = $nhCompany->status == 0 && App\Models\Job::where('queue', 'remove_company_'.$nhCompany->id)->count() != 0; // Free package: whole days left of the period (0 = renewable), null for paid packages. $nhFreeDaysLeft = $nhCompany->package && $nhCompany->package->monthly_cost == 0 && $nhCompany->expire_date ? $nhCompany->freeDaysLeft() : null; $nhAgreements = $nhUser->newAgreements($agreementCode ?? null); // Versioned through mix-manifest.json once webpack.mix.js builds nuhet.css. $nhManifest = json_decode((string) @file_get_contents(public_path('mix-manifest.json')), true) ?: []; $nhCss = $nhManifest['/css/nuhet.css'] ?? '/css/nuhet.css'; $nhAgreementJs = public_path('js/agreement.js'); $nhAgreementVersion = is_file($nhAgreementJs) ? filemtime($nhAgreementJs) : 1; $nhPageName = trim($__env->yieldContent('pagename')) ?: trim($__env->yieldContent('_pageTitle')); // Flash types of the old toastr calls mapped to the nh-toast status modifiers. $nhToastTypes = ['success' => 'ok', 'error' => 'bad', 'warning' => 'warn', 'info' => 'info']; $nhToasts = collect([session('toastr'), session('message')]) ->filter(fn ($flash) => is_array($flash)) ->map(fn ($flash) => [ 'type' => $nhToastTypes[$flash['type'] ?? ''] ?? 'ok', 'title' => $flash['title'] ?? '', 'msg' => $flash['msg'] ?? '', ]); @endphp @yield('_pageTitle') - Nuhet @stack('styles') {{ __('nav.skipToContent') }} @if ($nhAdminPage) @include('partials.nh-admin-navigation') @endif
Nuhet @if ($nhPageName !== '') {{-- yieldContent() is already escaped (@section('x', $value) runs e()), as in ; {{ }} would double-escape "&". Views set pagename and _pageTitle only in that inline form (NuhetLayoutTest guards it). --}} <span class="nh-pagename">{!! $nhPageName !!}</span> @endif <span class="nh-topbtns"> <a class="nh-iconbtn" data-nh-unread="{{ $nhUnreadNotices > 0 ? 'true' : 'false' }}" href="{{ route('notice.index') }}" aria-label="{{ trans_choice('nav.noticesLabel', $nhUnreadNotices, ['count' => $nhUnreadNotices]) }}"> <x-icon name="bell" /> @if ($nhUnreadNotices > 0) <span class="nh-badge" aria-hidden="true">{{ $nhUnreadNotices }}</span> @endif </a> <a class="nh-iconbtn" href="{{ route('media.index') }}" aria-label="{{ __('navigation.medialibrary') }}"> <x-icon name="image" /> </a> </span> </header> @include('partials.nav', ['nhUnreadNotices' => $nhUnreadNotices]) <main class="nh-main" id="nh-main" tabindex="-1"> <div class="nh-banners"> @if ($nhOverride) <div class="nh-banner nh-banner-warn"> <x-icon name="warning" size="20" /> <p class="nh-bannertext">{{ __('nav.overrideNotice', ['company' => $nhUser->company->name]) }}</p> <a class="nh-btn nh-btn-quiet" href="{{ route('admin.company.login', 0) }}">{{ __('nav.overrideBack') }}</a> </div> @endif @if ($nhRemovalPending) <div class="nh-banner nh-banner-bad"> <x-icon name="warning" size="20" /> <p class="nh-bannertext">{{ __('notice.accountRemovalAlert') }} <b>{{ $nhCompany->expire_date->diffForHumans() }} ({{ \App\Support\DisplayDate::timestamp($nhCompany->expire_date) }})</b></p> </div> @endif @if (! request()->routeIs('admin.*') && ! is_null($nhFreeDaysLeft)) {{-- The old partials/freePopUp box: renewal opens when the period has run out. --}} <div @class(['nh-banner', 'nh-banner-info' => $nhFreeDaysLeft > 0, 'nh-banner-warn' => $nhFreeDaysLeft === 0]) data-nh-free> @if ($nhFreeDaysLeft === 0) <x-icon name="warning" size="20" /> @endif <p class="nh-bannertext"> <b>{{ trans_choice('global.freePopUp.counter', $nhFreeDaysLeft) }}.</b> {{ __($nhFreeDaysLeft === 0 ? 'global.freePopUp.infoExpired' : 'global.freePopUp.info', ['expire_date' => $nhCompany->expire_date->toDateString()]) }} @if ($nhFreeDaysLeft > 0) {{ __('global.freePopUp.renewBtnTitle') }} @endif </p> @if ($nhFreeDaysLeft === 0) {{-- Renewing changes data, so it is a CSRF POST (#3089); the button sits outside its form to keep the banner layout. --}} <form id="nh-free-renew" method="POST" action="{{ route('account.renew', $nhCompany->id) }}" hidden>@csrf</form> <button type="submit" form="nh-free-renew" class="nh-btn nh-btn-primary" title="{{ __('global.freePopUp.btnTitle') }}">{{ __('global.freePopUp.renewBtn') }}</button> @endif <a @class(['nh-btn', 'nh-btn-primary' => $nhFreeDaysLeft > 0, 'nh-btn-quiet' => $nhFreeDaysLeft === 0]) href="{{ route('account.edit') }}">{{ __('global.upgradePackage') }}</a> </div> @endif @yield('banners') </div> @yield('page') <footer class="nh-mainfoot">{{ __('nav.footer', ['year' => date('Y')]) }} @include('partials.nh-version')</footer> </main> </div> <div class="nh-toasts" id="nh-toasts" role="status" aria-live="polite"> @foreach ($nhToasts as $nhToast) <div class="nh-toast nh-toast-{{ $nhToast['type'] }}"> <p class="nh-toasttext"><b>{{ $nhToast['title'] }}</b> {{ $nhToast['msg'] }}</p> <button type="button" class="nh-toastclose" data-nh-dismiss aria-label="{{ __('nav.close') }}"><x-icon name="close" size="20" /></button> </div> @endforeach </div> <template id="nh-toast-close"> <button type="button" class="nh-toastclose" data-nh-dismiss aria-label="{{ __('nav.close') }}"><x-icon name="close" size="20" /></button> </template> @include('partials.nh-support') {{-- Vue mount point of the old layout, mounted by js/agreement.js (resources/assets/js/app.js). The old <feedback> component is left out on purpose: its floating "Ge feedback" tab would sit over the top bar, and the rail foot / Mer sheet "Ge feedback" item opens the nh-support dialog instead. --}} <div id="vue-wrapper"> @if ($nhAgreements->count() != 0) <agreement shell="nh" :agreements="{{ json_encode($nhAgreements) }}"></agreement> @endif </div> <script> var _token = @json(csrf_token()); var routename = @json(Route::currentRouteName()); (function () { var TOAST_MS = 5000; var SUBMIT_LOCK_MS = 2000; // type is an nh-toast modifier: ok, bad, warn or info. function toast(type, text) { var item = document.createElement('div'); var p = document.createElement('p'); item.className = 'nh-toast nh-toast-' + type; p.className = 'nh-toasttext'; p.textContent = text; item.appendChild(p); item.appendChild(document.getElementById('nh-toast-close').content.cloneNode(true)); document.getElementById('nh-toasts').appendChild(item); setTimeout(function () { item.remove(); }, TOAST_MS); } window.nhToast = toast; document.querySelectorAll('#nh-toasts .nh-toast').forEach(function (item) { setTimeout(function () { item.remove(); }, TOAST_MS); }); // Double-submit guard (the old layout's jQuery one, for every submit // control): the submitter looks disabled for 2 s and a second submit // of the same form in that window is dropped. Forms whose own script // already called preventDefault (fetch forms such as the support // dialog) handle their own submits and are left alone. var lockedForms = new WeakSet(); document.addEventListener('submit', function (event) { var form = event.target; if (event.defaultPrevented || !(form instanceof HTMLFormElement)) { return; } if (lockedForms.has(form)) { event.preventDefault(); return; } lockedForms.add(form); var submitter = event.submitter || form.querySelector('[type="submit"], button:not([type])'); if (submitter) { submitter.setAttribute('aria-disabled', 'true'); submitter.classList.add('disabled'); } setTimeout(function () { lockedForms.delete(form); if (submitter) { submitter.removeAttribute('aria-disabled'); submitter.classList.remove('disabled'); } }, SUBMIT_LOCK_MS); }); document.addEventListener('click', function (event) { var opener = event.target.closest('[data-nh-dialog]'); if (opener) { var dialog = document.getElementById(opener.getAttribute('data-nh-dialog')); if (dialog && dialog.showModal) { event.preventDefault(); document.querySelectorAll('dialog[open]').forEach(function (open) { open.close(); }); dialog.showModal(); } return; } if (event.target.closest('[data-nh-close]')) { event.target.closest('dialog').close(); return; } if (event.target.closest('[data-nh-dismiss]')) { event.target.closest('.nh-toast').remove(); return; } // A click on the scrim (the dialog box itself, outside its content) // closes it, except for dialogs that must be answered (data-nh-static). if (event.target.tagName === 'DIALOG' && !event.target.hasAttribute('data-nh-static')) { event.target.close(); } }); })(); </script> <script src="/js/agreement.js?{{ $nhAgreementVersion }}"></script> <script src="/js/nuhet/support-feedback.js?{{ @filemtime(public_path('js/nuhet/support-feedback.js')) }}" defer></script> <script src="/js/nuhet/interface-preferences.js?{{ @filemtime(public_path('js/nuhet/interface-preferences.js')) }}" defer></script> <script src="/js/nuhet/mobile-tabs.js?{{ @filemtime(public_path('js/nuhet/mobile-tabs.js')) }}" defer></script> <script src="/js/nuhet/tag-pills.js?{{ @filemtime(public_path('js/nuhet/tag-pills.js')) }}" defer></script> <script src="/js/nuhet/tooltips.js?{{ @filemtime(public_path('js/nuhet/tooltips.js')) }}" defer></script> @stack('scripts') @include('partials.googleAnalytics') <script src="/js/nuhet/pagination.js?{{ @filemtime(public_path('js/nuhet/pagination.js')) }}" defer></script> </body> </html>