@php use \App\Models\PermissionModule; $groupNames = PermissionModule::GROUP_NAMES; $scopes = $input->hiddenData('modules'); $input->order = 1; $actionCount = count($groupNames); $columnCount = 4 + $actionCount; $__id__ = $input->hiddenData('__id__'); $render = function ($render, $modules, $prefixName = '') use($input, $actionCount, $columnCount, $groupNames, $__id__){ $html = ''; foreach($modules as $module){ $html .= ' '.$input->order.' '.htmlentities($prefixName . $module->name).' '.htmlentities($module->description).' '; if($module->module_action_groups){ foreach ($module->module_action_groups as $slug => $group) { $old = old($group?$input->name . '.' . $module->id . '.groups': "-------no--------" ); $checked = $old && is_array($old && in_array($group->id, $old))?true:( $group && $group->role_id_list && in_array($__id__, $group->role_id_list)?true:false ); $html .= ' '.($group?'':'').' '; } }else{ $html .= ''; } $html.=' '; $input->order++; if($module->modules && count($module->modules)){ // $html .= ''.htmlentities($prefixName . $module->name . ' > Sub-Modules').''; $html .= $render($render, $module->modules, $prefixName . $module->name . ' > '); // $html .= ''.htmlentities('--- End ---').''; } } return $html; }; $input->addClass('module-table'); $wrapper = $input->copy(); $wrapper->tagName = 'div'; $wrapper->type='wrapper'; $wrapper->name='wrapper'; $wrapper->id.='-wrapper'; $wrapper->removeClass('form-control', 'm-input'); add_css_link('static/features/permissions/style.css'); add_js_src('static/features/permissions/script.js'); @endphp
attrsToStr() !!} > @if ($scopes && count($scopes)) @foreach ($scopes as $scope)

{{$scope->name}}

@foreach ($groupNames as $slug => $name) @endforeach {!! $render($render, $scope->modules??[]) !!}
STT Tên Module Mô tả
@endforeach @endif