menu.blade.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. $module_parent = DB::table('role_acl')
  3. ->select('module_parent','module_name','pathParent','menu_icon')
  4. ->join('modules','role_acl.module_parent','=','modules.id')
  5. ->where('role_id', Auth::user()->role_id)
  6. ->where(function ($query){
  7. $query->where('create_acl','<>',0)
  8. ->orWhere('read_acl','<>',0)
  9. ->orWhere('update_acl','<>',0)
  10. ->orWhere('delete_acl','<>',0);
  11. })
  12. ->groupBy('module_parent')
  13. ->groupBy('module_name')
  14. ->groupBy('pathParent')
  15. ->groupBy('menu_icon')
  16. ->orderBy('module_parent','asc')
  17. ->get();
  18. ?>
  19. <?php
  20. $getStatus = App\Model\Privillage\Role::where('id',Auth::user()->role_id)->value('akses');
  21. ?>
  22. <li class="nav-item">
  23. <a class=" nav-link curved-btn {{ (Request::url() === url('/program')) ? 'active' : '' }} " href=" {{url('/program')}}"> <i class="ni ni-bullet-list-67 text-whiteX"></i> Program &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
  24. </a>
  25. </li>
  26. @if($getStatus == 'administrator')
  27. <li class="nav-item class=" active>
  28. <a class=" nav-link curved-btn {{ (Request::url() === url('/')) ? 'active' : '' }} " href=" {{url('/')}}"> <i class="ni ni-tv-2 text-whiteX"></i> Dashboard
  29. </a>
  30. </li>
  31. @endif
  32. <li class="nav-item class=" active>
  33. <a class=" nav-link curved-btn {{ (Request::url() === url('/data-viz')) ? 'active' : '' }} " href=" {{url('/data-viz')}}"> <i class="fa fa-table text-whiteX"></i> Data Viz Tableau
  34. </a>
  35. </li>
  36. @foreach($module_parent as $parent)
  37. <li class="nav-item">
  38. <a class="nav-link curved-btn {{ Request::is($parent->pathParent.'/*') ? 'active' : '' }}" data-toggle="collapse" href="#col{{$parent->module_parent}}" role="button" aria-expanded="false" aria-controls="col2">
  39. <i class="{{$parent->menu_icon}} text-whiteX"></i> {{$parent->module_name}}
  40. </a>
  41. </li>
  42. <?php
  43. $module_childs = DB::table('role_acl')
  44. ->join('modules','role_acl.module_id','=','modules.kdModule')
  45. ->where('module_parent',$parent->module_parent)
  46. ->where('role_id', Auth::user()->role_id)
  47. ->where(function ($query) {
  48. $query->where('create_acl','<>',0)
  49. ->orWhere('read_acl','<>',0)
  50. ->orWhere('update_acl','<>',0)
  51. ->orWhere('delete_acl','<>',0);
  52. })
  53. ->orderBy('menu_order','asc')
  54. ->get();
  55. ?>
  56. <div class="collapse {{ Request::is($parent->pathParent.'/*') ? 'show' : '' }} multi-collapse" id="col{{$parent->module_parent}}">
  57. @foreach($module_childs as $child)
  58. <div class="card card-body list-menus">
  59. <ul style="padding-right: 0px;">
  60. <li class="nav-item"><a class="nav-link {{ str_contains(URL::current(),$child->menu_path) ? 'active curved-btn' : '' }} lk-subs" href="{{url($child->menu_path)}}">{{$child->module_name}}</a></li>
  61. </ul>
  62. </div>
  63. @endforeach
  64. </div>
  65. @endforeach