navbar.blade.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. {!! admin_section(Dcat\Admin\Admin::SECTION['NAVBAR_BEFORE']) !!}
  2. @if(!$configData['horizontal_menu'])
  3. <nav class="header-navbar navbar-expand-lg navbar
  4. navbar-with-menu {{ $configData['navbar_class'] }}
  5. {{ $configData['navbar_color'] }}
  6. navbar-light navbar-shadow " style="top: 0;">
  7. <div class="navbar-wrapper">
  8. <div class="navbar-container content">
  9. @if(! $configData['horizontal_menu'])
  10. <div class="mr-auto float-left bookmark-wrapper d-flex align-items-center">
  11. <ul class="nav navbar-nav">
  12. <li class="nav-item mr-auto">
  13. <a class="nav-link menu-toggle" data-widget="pushmenu" style="cursor: pointer;">
  14. <i class="fa fa-bars font-md-2"></i>
  15. </a>
  16. </li>
  17. </ul>
  18. </div>
  19. @endif
  20. <div class="navbar-collapse d-flex justify-content-between">
  21. <div class="navbar-left d-flex align-items-center">
  22. {!! Dcat\Admin\Admin::navbar()->render('left') !!}
  23. </div>
  24. @if($configData['horizontal_menu'])
  25. <div class="d-md-block horizontal-navbar-brand justify-content-center text-center">
  26. <ul class="nav navbar-nav flex-row">
  27. <li class="nav-item mr-auto">
  28. <a href="{{ admin_url('/') }}" class="waves-effect waves-light">
  29. <span class="logo-lg">{!! config('admin.logo') !!}</span>
  30. </a>
  31. </li>
  32. </ul>
  33. </div>
  34. @endif
  35. <div class="navbar-right d-flex align-items-center">
  36. {!! Dcat\Admin\Admin::navbar()->render() !!}
  37. <!--
  38. @if(!empty($configData['home_url']))
  39. <a href="{{$configData['home_url']}}" target="_blank" class="nav-link"><i class="fa fa-home f18"></i></a>
  40. @endif
  41. @if(isset($configData['full_screen']) && $configData['full_screen'])
  42. <a href="javascript:;" data-check-screen="full" class="nav-link"><i class="feather icon-maximize f16"></i></a>
  43. @endif
  44. -->
  45. {{-- <i class="fa fa-language f16"></i>--}}
  46. {{-- <a class="lang-item " href="javascript:void(0);" data-lang="en">English</a>--}}
  47. {{-- <a class="lang-item " href="javascript:void(0);" data-lang="zh_CN">中文</a>--}}
  48. <ul class="nav navbar-nav">
  49. {{--User Account Menu--}}
  50. {!! admin_section(Dcat\Admin\Admin::SECTION['NAVBAR_USER_PANEL']) !!}
  51. {!! admin_section(Dcat\Admin\Admin::SECTION['NAVBAR_AFTER_USER_PANEL']) !!}
  52. </ul>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </nav>
  58. @endif
  59. {!! admin_section(Dcat\Admin\Admin::SECTION['NAVBAR_AFTER']) !!}
  60. <style>
  61. .lang-item {
  62. margin-left: 0.5rem;
  63. }
  64. </style>
  65. <script>
  66. document.querySelectorAll('.lang-item').forEach(item => {
  67. item.addEventListener('click', function() {
  68. const lang = this.getAttribute('data-lang');
  69. switchLanguage(lang);
  70. });
  71. });
  72. function switchLanguage(lang) {
  73. fetch(`/prime-control/language-switch?lang=${encodeURIComponent(lang)}`, {
  74. method: 'GET'
  75. })
  76. .then(response => {
  77. if (!response.ok) {
  78. throw new Error('Network response was not ok');
  79. }
  80. return response.json();
  81. })
  82. .then(data => {
  83. if (data.success) {
  84. window.location.reload();
  85. } else {
  86. throw new Error(data.error || 'Language switch failed');
  87. }
  88. })
  89. .catch(error => {
  90. console.error('Language Switch Error:', error);
  91. alert('Failed to switch language. Please try again.');
  92. });
  93. }
  94. </script>