@props([ 'permission'=>'dashboard.view', 'href'=>'', 'icon'=>'', 'title'=>'', 'type'=>'', 'modal'=>false, 'modaltitle'=>'تعديل عنصر', 'modallevel'=>'1', ]) @can($permission) @php $def_icons=[ 'edit'=>'ki-filled ki-pencil', 'delete'=>'ki-filled ki-trash', 'show'=>'ki-filled ki-search-list', 'print'=>'ki-filled ki-printer', 'follow'=>'ki-filled ki-search-list', 'export'=>'ki-filled ki-file-up', 'deactivate'=>'ki-filled ki-lock', 'activate'=>'ki-filled ki-check', ]; $icon= $def_icons[$type] ?? $icon; $classes='kt-menu-link '; $isFollow = $type === 'follow'; if ($isFollow) { $classes .= ' rounded-lg border border-blue-200 bg-blue-50 hover:bg-blue-100 '; } if($modal){ $classes.=' OpenModal'; } $isBulkAction = ($attributes->get('data-bulk-action') ?? '') === 'action'; $livewireEvent = (string) ($attributes->get('data-livewire-event') ?? ''); $shouldBypassBulkConfirm = $isBulkAction && $livewireEvent !== ''; $finalAttributes = $shouldBypassBulkConfirm ? $attributes->except('data-bulk-action') : $attributes; @endphp @if($type == 'separator')
@else
merge(['class' =>$classes])}} data-title="{{$modaltitle}}" @if($shouldBypassBulkConfirm) onclick="event.preventDefault();event.stopPropagation();const eventName=this.dataset.livewireEvent||'';const scope=this.closest('.kt-card')||document;const selectedIds=Array.from(scope.querySelectorAll('.CheckedItem:checked')).map((el)=>Number(el.value)).filter((id)=>id>0);if(window.Livewire&&eventName){window.Livewire.dispatch(eventName,{selectedIds});}return false;" @elseif(($attributes->get('data-bulk-action') ?? '') === 'action') onclick="return window.handleBulkActionClick ? window.handleBulkActionClick(event,this) : true;" @endif level="{{$modallevel}}"> {{$title}}
@endif @endcan