Files
numstation-web/resources/views/themes/tailwind/layouts/app.blade.php
2023-12-22 12:35:55 +08:00

261 lines
13 KiB
PHP

<?php
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\Auth;
$routeName = Route::currentRouteName();
$routeName = str_replace('.', '-', $routeName);
?>
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
{{-- @if(isset($seo->title))
<title>{{ $seo->title }}</title>
@else
<title>{{ setting('site.title', 'Laravel Wave') . ' - ' . setting('site.description', 'The Software as a Service Starter Kit built on Laravel & Voyager') }}</title>
@endif --}}
<title>{{ config('app.name', 'Numstation') }}</title>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge"> <!-- † -->
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta name="url" content="{{ url('/') }}">
<link rel="icon" href="{{ setting('site.favicon', '/wave/favicon.png') }}" type="image/x-icon">
{{-- Social Share Open Graph Meta Tags --}}
@if(isset($seo->title) && isset($seo->description) && isset($seo->image))
<meta property="og:title" content="{{ $seo->title }}">
<meta property="og:url" content="{{ Request::url() }}">
<meta property="og:image" content="{{ $seo->image }}">
<meta property="og:type" content="@if(isset($seo->type)){{ $seo->type }}@else{{ 'article' }}@endif">
<meta property="og:description" content="{{ $seo->description }}">
<meta property="og:site_name" content="{{ setting('site.title') }}">
<meta itemprop="name" content="{{ $seo->title }}">
<meta itemprop="description" content="{{ $seo->description }}">
<meta itemprop="image" content="{{ $seo->image }}">
@if(isset($seo->image_w) && isset($seo->image_h))
<meta property="og:image:width" content="{{ $seo->image_w }}">
<meta property="og:image:height" content="{{ $seo->image_h }}">
@endif
@endif
<meta name="robots" content="index,follow">
<meta name="googlebot" content="index,follow">
@if(isset($seo->description))
<meta name="description" content="{{ $seo->description }}">
@endif
<!-- Styles -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet">
<link href="{{ asset('themes/' . $theme->folder . '/css/app.css') }}" rel="stylesheet">
<link href="{{ asset('themes/' . $theme->folder . '/css/dataTable.css') }}" rel="stylesheet">
<link href="{{ asset('themes/' . $theme->folder . '/css/style.css') }}" rel="stylesheet">
<link href="{{ asset('themes/' . $theme->folder . '/css/cms-dashboard-style.css') }}" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.32/dist/sweetalert2.min.css">
@yield('style')
<script type="text/javascript" src="{{ asset('themes/' . $theme->folder . '/js/tinymce.min.js') }}"></script>
<script>
tinymce.init({
selector:'.tinymce',
menubar: false,
toolbar: "undo redo spellcheckdialog | blocks fontsize | bold italic | link image | alignleft aligncenter alignright alignjustify | indent outdent",
});
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11.7.32/dist/sweetalert2.all.min.js"></script>
</head>
<body class="flex flex-col min-h-screen page-{{ $routeName }} @if(Request::is('/')){{ 'bg-white' }}@else{{ 'bg-gray-50' }}@endif @if(config('wave.dev_bar')){{ 'pb-10' }}@endif">
{{-- @if(config('wave.demo') && Request::is('/'))
@include('theme::partials.demo-header')
@endif --}}
@if(!Auth::check() && $routeName != 'login' && $routeName != 'admin-login' && $routeName != 'user-terms-and-conditions' && $routeName != 'user-privacy-policy' && $routeName != 'user-register' && $routeName != 'forgot-password' && $routeName != 'register' && $routeName != 'verify')
@include('theme::partials.header')
@yield('content')
@include('theme::partials.footer')
@else
@if($routeName == 'login' || $routeName == 'admin-login' || $routeName == 'user-terms-and-conditions' || $routeName == 'user-privacy-policy' || $routeName == 'user-register' || $routeName == 'forgot-password' || $routeName == 'register' || $routeName == 'verify')
@yield('content')
@else
<main class="flex-grow overflow-x-hidden">
<section class="main-section-dashboard">
@include('theme::partials.sidebar')
<div class="main-content">
@include('theme::partials.dashboard-navigation')
<div class="main-inside-content">
<input type="hidden" id="currentLanguage" value="{{ strtolower(app()->getLocale()) }}">
@yield('content')
</div>
</div>
</section>
</main>
@endif
@if(config('wave.dev_bar'))
@include('theme::partials.dev_bar')
@endif
@endif
<!-- Full Screen Loader -->
<div id="fullscreenLoader" class="fixed inset-0 top-0 left-0 z-50 flex flex-col items-center justify-center hidden w-full h-full bg-gray-900 opacity-50">
<svg class="w-5 h-5 mr-3 -ml-1 text-white animate-spin" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
</svg>
<p id="fullscreenLoaderMessage" class="mt-4 text-sm font-medium text-white uppercase"></p>
</div>
<!-- End Full Loader -->
<script src="{{ asset('themes/' . $theme->folder . '/js/app.js') }}"></script>
@vite(['resources/js/app.js'])
@include('theme::partials.toast')
@if(session('show_toast') && session('message'))
<script>setTimeout(function(){ popToast("{{ session('message_type') }}", "{!! session('message') !!}"); }, 10);</script>
@endif
@waveCheckout
<script type="text/javascript" src="{{ asset('themes/' . $theme->folder . '/js/jquery.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('themes/' . $theme->folder . '/js/dataTable.js') }}"></script>
<script>
$(function() {
$(document).on('keydown', '.number-only', function(e) {
// Allow: backspace, delete, tab, escape, enter
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 190]) !== -1 ||
// Allow: Ctrl+A,Ctrl+C,Ctrl+X,Ctrl+V, Command+A
((e.keyCode == 65 || e.keyCode == 86 || e.keyCode == 88 || e.keyCode == 67) && (e.ctrlKey === true || e.metaKey === true)) ||
// Allow: home, end, left, right, down, up, F5
(e.keyCode >= 35 && e.keyCode <= 40) || e.keyCode == 116) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
$('#notificationWrapper').html('');
var notificationOffset = 0;
var notificationLimit = 5;
if ('{{ Auth::check() }}') {
getNotifications();
}
$(document).on('click', '#notificationShowMore', function(e) {
notificationOffset += notificationLimit;
getNotifications(true);
});
function getNotifications(isShowMore = false) {
var url = "{{ route('cms.get-notifications') }}?offset=" + notificationOffset + '&limit=' + notificationLimit;
var showMoreHtml = $('#notificationShowMore').html();
if (!isShowMore || (isShowMore && !$('#notificationShowMore').is('[disabled=disabled]'))) {
$('#notificationShowMore').attr('disabled', 'disabled');
$('#notificationShowMore').html('<i class="fa-solid fa-ellipsis fa-fade" style="font-size: 30px;"></i>');
$.ajax({
url: url,
type: "get",
dataType: 'json',
success:function(response) {
var notifications = response.notifications;
var hasNew = response.has_new;
var html = '';
var previousCategory = '';
var index = 0;
if (notifications.length > 0) {
notifications.forEach(function(item) {
if (previousCategory != item.category) {
html += `
<div class="dropdown-list-item">
<div class="dropdown-sidetext">
<h4 class="dropdown-subtitle">` + item.category + `</h4>
<a href="` + item.category_url + `">{{ __("Check") }}</a>
</div>
<ul class="dropdown-list">
`;
}
if (item.category.toLowerCase() == 'service chat') {
html += `
<li class="w-100">
<div class="item-list">
<img src="` + item.image_url + `">
<span class="w-100">` + item.description + `</span>
<a href="` + item.url + `">{{ __("Check") }}</a>
</div>
</li>
`;
}
else if (item.category.toLowerCase() == 'bookkeeping queue') {
var status = 'success';
if (item.status == 'failed') {
status = 'failed';
}
html += `
<li class="w-100">
<div class="item-list">
<img src="` + item.image_url + `">
<span class="w-100">` + item.description + ` <i class="item-list-note ` + status + `">` + (status == 'success' ? '{{ __("Entry Completed") }}' : '{{ __("Failed") }}') + `</i></span>
<a href="` + item.url + `">{{ __("Check") }}</a>
</div>
</li>
`;
}
index++;
if (notifications[index] == undefined || item.category != notifications[index].category) {
html += `
</ul>
</div>
`;
}
previousCategory = item.category;
});
$('#notificationWrapper').append(html);
}
else {
$('#notificationShowMore').addClass('d-none');
}
$('#notificationShowMore').removeAttr('disabled');
$('#notificationShowMore').html(showMoreHtml);
if (!isShowMore) {
if (hasNew) {
$('.notification-icon .new-icon').show();
}
else {
$('.notification-icon .new-icon').hide();
}
}
}
});
}
}
});
</script>
@yield('script')
</body>
</html>