You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.blade.php 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. @props([
  2. 'navigation',
  3. ])
  4. <div
  5. {{
  6. $attributes->class([
  7. 'fi-topbar sticky top-0 z-20 overflow-x-clip',
  8. 'fi-topbar-with-navigation' => filament()->hasTopNavigation(),
  9. ])
  10. }}
  11. >
  12. <nav
  13. class="flex h-16 items-center gap-x-4 bg-white px-4 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 md:px-6 lg:px-8"
  14. >
  15. {{ \Filament\Support\Facades\FilamentView::renderHook('panels::topbar.start') }}
  16. @if(filament()->hasNavigation())
  17. <x-filament::icon-button
  18. color="gray"
  19. icon="heroicon-o-bars-3"
  20. icon-alias="panels::topbar.open-sidebar-button"
  21. icon-size="lg"
  22. :label="__('filament-panels::layout.actions.sidebar.expand.label')"
  23. x-cloak
  24. x-data="{}"
  25. x-on:click="$store.sidebar.open()"
  26. x-show="! $store.sidebar.isOpen"
  27. @class([
  28. 'lg:hidden' => (! filament()->isSidebarFullyCollapsibleOnDesktop()) || filament()->isSidebarCollapsibleOnDesktop(),
  29. ])
  30. />
  31. <x-filament::icon-button
  32. color="gray"
  33. icon="heroicon-o-x-mark"
  34. icon-alias="panels::topbar.close-sidebar-button"
  35. icon-size="lg"
  36. :label="__('filament-panels::layout.actions.sidebar.collapse.label')"
  37. x-cloak
  38. x-data="{}"
  39. x-on:click="$store.sidebar.close()"
  40. x-show="$store.sidebar.isOpen"
  41. class="lg:hidden"
  42. />
  43. @endif
  44. @if (filament()->hasTopNavigation() || (! filament()->hasNavigation()))
  45. <div class="me-6 hidden lg:flex">
  46. @if ($homeUrl = filament()->getHomeUrl())
  47. <a {{ \Filament\Support\generate_href_html($homeUrl) }}>
  48. <x-filament-panels::logo />
  49. </a>
  50. @else
  51. <x-filament-panels::logo />
  52. @endif
  53. </div>
  54. @if (filament()->hasTenancy() && filament()->hasTenantMenu())
  55. <x-filament-panels::tenant-menu class="hidden lg:block" />
  56. @endif
  57. @if (filament()->hasNavigation())
  58. <ul class="me-4 hidden items-center gap-x-4 lg:flex">
  59. @foreach($navigation as $group)
  60. @if ($group->getLabel() === null)
  61. @foreach ($group->getItems() as $item)
  62. <x-filament-panels::topbar.item
  63. :active="$item->isActive()"
  64. :active-icon="$item->getActiveIcon()"
  65. :badge="$item->getBadge()"
  66. :badge-color="$item->getBadgeColor()"
  67. :icon="$item->getIcon()"
  68. :should-open-url-in-new-tab="$item->shouldOpenUrlInNewTab()"
  69. :url="$item->getUrl()"
  70. >
  71. {{ $item->getLabel() }}
  72. </x-filament-panels::topbar.item>
  73. @endforeach
  74. @endif
  75. @endforeach
  76. @foreach ($navigation as $group)
  77. @php
  78. $groupLabel = $group->getLabel();
  79. $groupItems = collect($group->getItems());
  80. $subgroups = $groupItems->groupBy(fn(\Filament\Navigation\NavigationItem $item) => $item->getParentItem())->filter(fn($subgroup, $key) => filled($key));
  81. $standaloneItems = $groupItems->reject(fn(\Filament\Navigation\NavigationItem $item) => filled($item->getParentItem()));
  82. $itemsCount = $groupItems->count();
  83. @endphp
  84. @if ($groupLabel)
  85. <x-filament::dropdown
  86. offset="0"
  87. width="max-w-fit"
  88. placement="bottom-start"
  89. teleport
  90. x-on:mouseenter="open"
  91. x-on:mouseleave="close"
  92. :attributes="
  93. \Filament\Support\prepare_inherited_attributes($attributes)
  94. ->class(['fi-topbar-dropdown'])
  95. "
  96. >
  97. <x-slot name="trigger">
  98. <x-filament-panels::topbar.item
  99. :active="$group->isActive()"
  100. :icon="$group->getIcon()"
  101. >
  102. {{ $groupLabel }}
  103. </x-filament-panels::topbar.item>
  104. </x-slot>
  105. <x-filament::dropdown.list>
  106. @if($subgroups->isNotEmpty() || $standaloneItems->isNotEmpty())
  107. <ul class="menu-groups">
  108. @foreach($subgroups as $subgroupTitle => $subgroupItems)
  109. <li class="menu-group cols-1">
  110. <div class="submenu-wrap">
  111. <div class="menu-label">{{ $subgroupTitle }}</div>
  112. <ul class="submenu cols-1">
  113. @foreach($subgroupItems as $item)
  114. <li class="menu-item cols-1">
  115. <x-filament::dropdown.list.item
  116. @class(['fi-topbar-dropdown-list-item' => $itemsCount > 1])
  117. :badge="$item->getBadge()"
  118. :badge-color="$item->getBadgeColor()"
  119. :href="$item->getUrl()"
  120. :icon="$item->isActive() ? ($item->getActiveIcon() ?? $item->getIcon()) : $item->getIcon()"
  121. tag="a"
  122. :target="$item->shouldOpenUrlInNewTab() ? '_blank' : null"
  123. >
  124. {{ $item->getLabel() }}
  125. </x-filament::dropdown.list.item>
  126. </li>
  127. @endforeach
  128. </ul>
  129. </div>
  130. </li>
  131. @endforeach
  132. @if($standaloneItems->isNotEmpty())
  133. <li class="menu-group cols-1">
  134. <div class="submenu-wrap">
  135. <div class="menu-label-invisible-spacer"></div>
  136. <ul class="submenu cols-1">
  137. @foreach($itemsWithoutSubgroup as $item)
  138. <li class="menu-item cols-1">
  139. <x-filament::dropdown.list.item
  140. @class([
  141. 'fi-topbar-dropdown-list-item' => $itemsCount > 1,
  142. ])
  143. :badge="$item->getBadge()"
  144. :badge-color="$item->getBadgeColor()"
  145. :href="$item->getUrl()"
  146. :icon="$item->isActive() ? ($item->getActiveIcon() ?? $item->getIcon()) : $item->getIcon()"
  147. tag="a"
  148. :target="$item->shouldOpenUrlInNewTab() ? '_blank' : null"
  149. >
  150. {{ $item->getLabel() }}
  151. </x-filament::dropdown.list.item>
  152. </li>
  153. @endforeach
  154. </ul>
  155. </div>
  156. </li>
  157. @endif
  158. </ul>
  159. @else
  160. @foreach ($group->getItems() as $item)
  161. <x-filament::dropdown.list.item
  162. @class([
  163. 'fi-topbar-dropdown-list-item' => $itemsCount > 1,
  164. ])
  165. :badge="$item->getBadge()"
  166. :badge-color="$item->getBadgeColor()"
  167. :href="$item->getUrl()"
  168. :icon="$item->isActive() ? ($item->getActiveIcon() ?? $item->getIcon()) : $item->getIcon()"
  169. tag="a"
  170. :target="$item->shouldOpenUrlInNewTab() ? '_blank' : null"
  171. >
  172. {{ $item->getLabel() }}
  173. </x-filament::dropdown.list.item>
  174. @endforeach
  175. @endif
  176. </x-filament::dropdown.list>
  177. </x-filament::dropdown>
  178. @endif
  179. @endforeach
  180. </ul>
  181. @endif
  182. @endif
  183. <div
  184. x-persist="topbar.end"
  185. class="ms-auto flex items-center gap-x-4"
  186. >
  187. {{ \Filament\Support\Facades\FilamentView::renderHook('panels::global-search.before') }}
  188. @if (filament()->isGlobalSearchEnabled())
  189. @livewire(Filament\Livewire\GlobalSearch::class, ['lazy' => true])
  190. @endif
  191. {{ \Filament\Support\Facades\FilamentView::renderHook('panels::global-search.after') }}
  192. @if (filament()->auth()->check())
  193. @if (filament()->hasDatabaseNotifications())
  194. @livewire(Filament\Livewire\DatabaseNotifications::class, ['lazy' => true])
  195. @endif
  196. <x-filament-panels::user-menu />
  197. @endif
  198. </div>
  199. {{ \Filament\Support\Facades\FilamentView::renderHook('panels::topbar.end') }}
  200. </nav>
  201. </div>