right-sidebar.blade copy.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. @php
  2. $currentBpa = App\Helpers\Utils::bpaDecoding(request('bpa'));
  3. $menuPage = App\Helpers\Utils::getMainMenu()['Page'] ?? [];
  4. $bpa = App\Helpers\Utils::bpaEncoding($menuPage)->pluck('bpa')->toArray();
  5. $menuPage = collect($menuPage)->map(function ($menu, $index) use ($bpa) {
  6. return array_merge($menu, ['bpa' => $bpa[$index]]);
  7. });
  8. @endphp
  9. <div class="sidebar sidebar-dark sidebar-right sidebar-expand-xl sidebar-collapsed overflow-auto">
  10. <!-- Sidebar content -->
  11. <div class="sidebar-section sidebar-user my-0 d-flex align-items-center justify-content-center p-1">
  12. <button class="btn btn-danger w-100 mr-1" onclick="show_manual_modal()">{{ $form['FormVars']['Title']['SelfManual'] }}</button>
  13. <button class="btn btn-primary w-100 mr-1" onclick="shortcut_in_or_out(1)">{{ $form['FormVars']['Title']['ShortcutIn'] }}</button>
  14. <button class="btn btn-primary w-100" onclick="shortcut_in_or_out(0)">{{ $form['FormVars']['Title']['ShortcutOut'] }}</button>
  15. <button type="button" class="tab-close position-absolute top-0 right-0 color-danger" onclick="close_right_sidebar()">
  16. <i class="fas fa-times fa-xs"></i>
  17. </button>
  18. {{-- <button class="btn btn-primary"><i class="fas fa-sign-in-alt"></i> {{ $form['FormVars']['Title']['ShortcutIn'] }}</button>
  19. <button class="btn btn-primary"><i class="fas fa-sign-out-alt"></i> {{ $form['FormVars']['Title']['ShortcutOut'] }}</button> --}}
  20. </div>
  21. <ul class="sidebar-section nav-right-sidebar nav nav-sidebar">
  22. </ul>
  23. <!-- /sidebar content -->
  24. </div>
  25. <script>
  26. $(document).ready(async function() {
  27. nav_right_sidebar_init();
  28. });
  29. function show_manual_modal() {
  30. const para_name = currentBpa['para_name'];
  31. get_para_data('manual', `/etc/self-manual${para_name}`, function (parameter) {
  32. // console.log(parameter)
  33. get_blades_html('front.outline.static.manual', parameter, function (html) {
  34. if (! $('#element_in_which_to_insert').find('#modal-manual').length) {
  35. $('#element_in_which_to_insert').append(html);
  36. }
  37. $('#modal-manual').find('#myModalLabel').text(`${currentBpa['menu_name']} 매뉴얼`)
  38. $('#modal-manual').modal('show')
  39. }, 'manual');
  40. })
  41. }
  42. function close_right_sidebar() {
  43. $('.sidebar-right').addClass('sidebar-collapsed')
  44. $('.sidebar-right').removeClass('sidebar-mobile-expanded')
  45. }
  46. function nav_right_sidebar_init() {
  47. let html = '';
  48. myMenu = menuPage.filter(menu => menu.IsMymenu == '1')
  49. myMenu.forEach(menu => {
  50. html +=
  51. `<li class="nav-item list-unstyled ml-0 text-left">
  52. <a href="${menu.PageUri}?bpa=${menu.bpa}" target="${menu.IsNewtab == 1 ? '_blank' : '_self'}"
  53. class="nav-link d-block ${menu.MenuCode == menuCode ? 'active text-orange' : 'text-orange'}"><i class="${menu.Icon} mr-2" style="width: 10px;"></i>
  54. ${menu.MenuName}
  55. </a>
  56. </li>`;
  57. });
  58. $('.nav-right-sidebar').html(html);
  59. }
  60. async function shortcut_in_or_out(is_mymenu) {
  61. let user_menu_id = menuPage.filter(menu => menu.MenuCode == menuCode)[0]['UserMenuId']
  62. let response = await get_api_data('is-mymenu-set', {
  63. UserMenuId: user_menu_id,
  64. IsMymenu: String(is_mymenu),
  65. })
  66. if (response.status == 200) {
  67. menuPage.map(menu => {
  68. if (menu.MenuCode == menuCode) {
  69. menu.IsMymenu = is_mymenu;
  70. }
  71. return menu;
  72. })
  73. nav_right_sidebar_init();
  74. $.ajax({
  75. url: "/clear-menu-cache",
  76. type:'POST',
  77. data: {
  78. _token:"{{ csrf_token() }}",
  79. },
  80. cache: false,
  81. success: function(response) {
  82. }
  83. });
  84. }
  85. }
  86. const menuPage = {!! json_encode($menuPage) !!};
  87. const currentBpa = {!! json_encode($currentBpa) !!};
  88. </script>