update global selectize

This commit is contained in:
Daeng Deni Mardaeni 2024-08-22 11:49:32 +07:00
parent c4e1e7a9ec
commit b545c0c85b
2 changed files with 58 additions and 56 deletions

View File

@ -3,18 +3,19 @@ import "./bootstrap";
import "../metronic/core/index";
import "../metronic/app/layouts/base.js";
import $ from 'jquery';
import $ from "jquery";
window.jQuery = $;
window.$ = $;
import TomSelect from "tom-select";
let settings = {
plugins: ['dropdown_input'],
create: false,
createOnBlur: true
};
document.querySelectorAll(".tomselect").forEach((el) => {
let settings = {
plugins: ["dropdown_input"],
create: false,
createOnBlur: true,
};
new TomSelect('.tomselect', settings);
new TomSelect(el, settings);
});

View File

@ -80,55 +80,56 @@
@php $headingSystem = 1; @endphp
@endif
@endif
@if(isset($menu->sub))
<div class="menu-item {{ request()->routeIs($menu->path) || request()->routeIs($menu->path.'.*') ? 'show' : '' }}" data-menu-item-toggle="accordion" data-menu-item-trigger="click">
<div
class="menu-link flex items-center grow cursor-pointer border border-transparent gap-[10px] pl-[10px] pr-[10px] py-[6px]"
tabindex="0">
<span class="menu-icon items-start text-gray-500 dark:text-gray-400 w-[20px]">
<i class="{{ $menu->icon ?? 'ki-filled ki-element-11 text-lg' }}"></i>
</span>
<span class="menu-title text-sm font-semibold text-gray-700 menu-item-active:text-primary menu-link-hover:!text-primary">
{{ $menu->title }}
</span>
<span class="menu-arrow text-gray-400 w-[20px] shrink-0 justify-end ml-1 mr-[-10px]">
<i class="ki-filled ki-plus text-2xs menu-item-show:hidden">
</i>
<i class="ki-filled ki-minus text-2xs hidden menu-item-show:inline-flex">
</i>
</span>
</div>
@if(is_array($menu->sub))
<div class="menu-accordion gap-0.5 pl-[10px] relative before:absolute before:left-[20px] before:top-0 before:bottom-0 before:border-l before:border-gray-200">
@foreach($menu->sub as $sub)
<div class="menu-item {{ request()->routeIs($sub->path.'.*') && in_array(request()->route()->getName(), [$sub->path.'.index', $sub->path.'.create', $sub->path.'.edit']) ? 'active' : '' }}">
<a class="menu-link gap-[14px] pl-[10px] pr-[10px] py-[8px] border border-transparent items-center grow menu-item-active:bg-secondary-active dark:menu-item-active:bg-coal-300 dark:menu-item-active:border-gray-100 menu-item-active:rounded-lg hover:bg-secondary-active dark:hover:bg-coal-300 dark:hover:border-gray-100 hover:rounded-lg"
href="{{ $sub->path ? route($sub->path.'.index') : '' }}" tabindex="0">
<span
class="menu-bullet flex w-[6px] relative before:absolute before:top-0 before:size-[6px] before:rounded-full before:-translate-x-1/2 before:-translate-y-1/2 menu-item-active:before:bg-primary menu-item-hover:before:bg-primary">
</span>
<span
class="menu-title text-2sm font-medium text-gray-700 menu-item-active:text-primary menu-item-active:font-semibold menu-link-hover:!text-primary">
{{ $sub->title }}
</span>
</a>
</div>
@endforeach
@if(auth()->user()->hasRole($menu->roles))
@if(isset($menu->sub))
<div class="menu-item {{ request()->routeIs($menu->path) || request()->routeIs($menu->path.'.*') ? 'show' : '' }}" data-menu-item-toggle="accordion" data-menu-item-trigger="click">
<div
class="menu-link flex items-center grow cursor-pointer border border-transparent gap-[10px] pl-[10px] pr-[10px] py-[6px]"
tabindex="0">
<span class="menu-icon items-start text-gray-500 dark:text-gray-400 w-[20px]">
<i class="{{ $menu->icon ?? 'ki-filled ki-element-11 text-lg' }}"></i>
</span>
<span class="menu-title text-sm font-semibold text-gray-700 menu-item-active:text-primary menu-link-hover:!text-primary">
{{ $menu->title }}
</span>
<span class="menu-arrow text-gray-400 w-[20px] shrink-0 justify-end ml-1 mr-[-10px]">
<i class="ki-filled ki-plus text-2xs menu-item-show:hidden">
</i>
<i class="ki-filled ki-minus text-2xs hidden menu-item-show:inline-flex">
</i>
</span>
</div>
@endif
</div>
@else
<div class="menu-item {{ request()->routeIs($menu->path.'.*') ? 'active' : '' }}">
<a class="menu-link flex items-center grow cursor-pointer border border-transparent gap-[10px] pl-[10px] pr-[10px] py-[6px]" href="{{ $menu->path ? route($menu->path.'.index') : '' }}">
<span class="menu-icon items-start text-gray-500 dark:text-gray-400 w-[20px]">
<i class="{{ $menu->icon ?? 'ki-filled ki-element-11 text-lg' }}"></i>
</span>
<span class="menu-title text-sm font-semibold text-gray-700 menu-item-active:text-primary menu-link-hover:!text-primary">
{{ $menu->title }}
</span>
</a>
</div>
@if(is_array($menu->sub))
<div class="menu-accordion gap-0.5 pl-[10px] relative before:absolute before:left-[20px] before:top-0 before:bottom-0 before:border-l before:border-gray-200">
@foreach($menu->sub as $sub)
<div class="menu-item {{ request()->routeIs($sub->path.'.*') && in_array(request()->route()->getName(), [$sub->path.'.index', $sub->path.'.create', $sub->path.'.edit']) ? 'active' : '' }}">
<a class="menu-link gap-[14px] pl-[10px] pr-[10px] py-[8px] border border-transparent items-center grow menu-item-active:bg-secondary-active dark:menu-item-active:bg-coal-300 dark:menu-item-active:border-gray-100 menu-item-active:rounded-lg hover:bg-secondary-active dark:hover:bg-coal-300 dark:hover:border-gray-100 hover:rounded-lg"
href="{{ $sub->path ? route($sub->path.'.index') : '' }}" tabindex="0">
<span
class="menu-bullet flex w-[6px] relative before:absolute before:top-0 before:size-[6px] before:rounded-full before:-translate-x-1/2 before:-translate-y-1/2 menu-item-active:before:bg-primary menu-item-hover:before:bg-primary">
</span>
<span
class="menu-title text-2sm font-medium text-gray-700 menu-item-active:text-primary menu-item-active:font-semibold menu-link-hover:!text-primary">
{{ $sub->title }}
</span>
</a>
</div>
@endforeach
</div>
@endif
</div>
@else
<div class="menu-item {{ request()->routeIs($menu->path.'.*') ? 'active' : '' }}">
<a class="menu-link flex items-center grow cursor-pointer border border-transparent gap-[10px] pl-[10px] pr-[10px] py-[6px]" href="{{ $menu->path ? route($menu->path.'.index') : '' }}">
<span class="menu-icon items-start text-gray-500 dark:text-gray-400 w-[20px]">
<i class="{{ $menu->icon ?? 'ki-filled ki-element-11 text-lg' }}"></i>
</span>
<span class="menu-title text-sm font-semibold text-gray-700 menu-item-active:text-primary menu-link-hover:!text-primary">
{{ $menu->title }}
</span>
</a>
</div>
@endif
@endif
@endforeach
@endforeach