<?php
require_once('advancenews-page-sys.php');
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">
  <title>
    <?php
    if ($page_title !='') {
      $page_title =$page_title;
    }else {
      if ($tt_page_title !='') {
          $page_title = $tt_page_title;
      }else {
        $page_title = '';
      }
    }

    ?>
    <?php echo $page_title.$cms_Data['TitleSeparetor'].$cms_Data['AppName'] ?>
  </title>

  <!-- Favicons -->
  <link href="assets/img/logo.png" rel="icon">
  <link href="assets/img/logo.png" rel="apple-touch-icon">

  <!-- Files  -->
  <link href="https://fonts.gstatic.com" rel="preconnect">
  <link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i|Nunito:300,300i,400,400i,600,600i,700,700i|Poppins:300,300i,400,400i,500,500i,600,600i,700,700i" rel="stylesheet">
  <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
  <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet">
  <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
  <link href="assets/vendor/remixicon/remixicon.css" rel="stylesheet">
  <link href="assets/vendor/simple-datatables/style.css" rel="stylesheet">
  <link href="assets/css/style.css" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="assets/vendor/nestable/nestable.css">
  <script src="assets/vendor/jquery/jquery-3.2.1.min.js"></script>
  <script src="assets/vendor/datatable-tt/datatables.min.js"></script>
  <link href="assets/vendor/datatable-tt/datatables.min.css" rel="stylesheet">
  <script src="assets/vendor/datatable-tt/dataTables.responsive.min.js"></script>
  <script src="assets/js/jquery.dm-uploader.min.js"></script>
  <script src="assets/js/ttup-ui.js"></script>
  <link href="assets/vendor/select2/select2.min.css" rel="stylesheet" />
  <script src="assets/vendor/select2/select2.min.js"></script>
  <link rel="stylesheet" type="text/css" href="assets/vendor/editor/richtext.min.css">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
  <script type="text/javascript" src="assets/vendor/editor/jquery.richtext.js"></script>

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/theme/material-ocean.css"></link>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/xml/xml.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/javascript/javascript.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/css/css.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/htmlmixed/htmlmixed.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/keymap/sublime.js"></script>
 
</head>
<body>
<!-- ======= Header ======= -->
<header id="header" class="header fixed-top d-flex align-items-center">
  <div class="d-flex align-items-center justify-content-between">
    <a href="index.php" class="logo d-flex align-items-center">
      <img src="assets/img/logo.png" alt="MFIT">
      <span class="d-none d-lg-block">MFIT</span>
    </a>
    <i class="bi bi-list toggle-sidebar-btn"></i>
    <a href="<?php echo $site_domain ?>" target="_blank" class="ms-3">HOME</a>
  </div>
  <nav class="header-nav ms-auto">
    <ul class="d-flex align-items-center">
      <li class="nav-item pe-3">
        <a class="nav-link nav-profile d-flex align-items-center pe-0" href="#" data-bs-toggle="dropdown">
          <img src="assets/img/profile-img.jpg" alt="Profile" class="rounded-circle">
          <span class="d-none d-md-block dropdown-toggle ps-2"><?php echo $the_user['admin_name'] ?></span>
        </a>
        <ul class="dropdown-menu dropdown-menu-end dropdown-menu-arrow profile">
          <li class="dropdown-header">
            <h6><?php echo $the_user['admin_name'] ?></h6>
            <span><?php echo $the_user['admin_role'] ?></span>
          </li>
          <li>
            <hr class="dropdown-divider">
          </li>
          <li>
            <hr class="dropdown-divider">
          </li>
          <li>
            <a class="dropdown-item d-flex align-items-center" href="security.php">
              <i class="bi bi-gear"></i>
              <span>Account Settings</span>
            </a>
          </li>
          <li>
            <a target="_blank" class="dropdown-item d-flex align-items-center" href="https://wa.me/+8801919524549">
              <i class="bi bi-person-video2"></i>
              <span>Developer</span>
            </a>
          </li>
          <li>
            <hr class="dropdown-divider">
          </li>
          <li>
            <a class="dropdown-item d-flex align-items-center" href="https://mf1t.com/">
              <i class="bi bi-question-circle"></i>
              <span>Need Help?</span>
            </a>
          </li>
          <li>
            <hr class="dropdown-divider">
          </li>
          <li>
            <a class="dropdown-item d-flex align-items-center" href="log-out.php">
              <i class="bi bi-box-arrow-right"></i>
              <span>Sign Out</span>
            </a>
          </li>
        </ul>
      </li>
    </ul>
  </nav>
</header>
<aside id="sidebar" class="sidebar">
  <ul class="sidebar-nav" id="sidebar-nav">
    <?php
     $main_manu_activation = 'collapsed';
     $submenu_activation_status = '';
     $submenu_activation_show = '';
     foreach ($advancenewsPages as $nav_item) {

       // && $curent_user_page_role == 'Super Admin'
       if (isset($nav_item['MenuTitle'])) {
         if ($curent_user_page_role != 'Super Admin' && $curent_user_page_role != 'Admin' && $nav_item['MenuTitle'] =='Customization') {
           // Dont Show Customization to Editor
         }else {
           ?>
           <li class="nav-heading"><?php echo $nav_item['MenuTitle'] ?></li>
           <?php
         }

       }else {

         if (isset($nav_item['PageChild'])){
          foreach ($nav_item['PageChild'] as $nav_sub_item) {
            if ($cur_page_link == $nav_sub_item['PageLink']){
             $submenu_activation_status = 'aria-expanded="true"';
             $submenu_activation_show = 'show';
             $main_manu_activation = '';
            }
          }
        }

        if ($nav_item['PageLink'] == $cur_page_link) {
          $main_manu_activation = '';
        }

        // Super Admin and other role show menue
        if ($curent_user_page_role == 'Super Admin' ||  in_array($nav_item['PageLink'], $accessible_pages)) {
            ?>
            <li class="nav-item ">
              <a <?php echo $submenu_activation_status ?> class="nav-link <?php echo $main_manu_activation ?> " <?php if (isset($nav_item['PageChild'])){ ?> data-bs-target="#<?php   echo $nav_item['PageID']; ?>" data-bs-toggle="collapse" <?php } ?> href="<?php echo $nav_item['PageLink']; ?>">
                <i class="<?php   echo $nav_item['PageIcon']; ?>"></i>
                <span><?php   echo $nav_item['PageName']; ?></span>
                <?php if (isset($nav_item['PageChild'])){ ?> <i class="bi bi-chevron-down ms-auto"></i> <?php } ?>
              </a>
              <?php if (isset($nav_item['PageChild'])){ ?>
                <ul  id="<?php echo $nav_item['PageID']; ?>" class="nav-content collapse  <?php echo $submenu_activation_show ?>" data-bs-parent="#sidebar-nav">
                  <?php
                  foreach ($nav_item['PageChild'] as $nav_sub_item) {

                    if ($curent_user_page_role == 'Super Admin' ||  in_array($nav_sub_item['PageLink'], $accessible_pages)) {
                      ?>
                      <li>
                        <a href="<?php echo $nav_sub_item['PageLink']; ?>" class="<?php if ($cur_page_link == $nav_sub_item['PageLink']){  echo "active"; } ?>">
                          <i class="bi bi-circle"></i><span><?php echo $nav_sub_item['PageName']; ?></span>
                        </a>
                      </li>
                      <?php
                    }
                    ?>

                    <?php
                  }
                   ?>
                </ul>
              <?php } ?>
            </li>
            <?php
        }
        ?>

        <?php
        $main_manu_activation = 'collapsed';
        $submenu_activation_status = '';
        $submenu_activation_show = '';
       }
     }
     ?>
  </ul>

</aside><!-- End Sidebar-->
<?php if ($page_id != 'AddMedia'): ?>
  <div class="modal fade" id="SelectMedia" tabindex="-1" aria-hidden="true">
    <div class="modal-dialog modal-dialog-scrollable modal-xl">
      <div class="modal-content border-0 rounded-0">
        <div class="modal-header p-2">
          <h5 class="modal-title" id="MediaSelectorTitle">Select Media</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="bg-white" style="overflow-x:hidden;">
          <div class="row" id="UploaderAdvanceNews">
            <div class="col-lg-4 bg-light">
              <div class="p-2">
                <div class="row">
                  <div class="col-12">
                    <!-- Our markup, the important part here! -->
                    <script type="text/javascript">
                    $(function(){
                      $('#drag-and-drop-zone').dmUploader({ //
                        url: 'inc/upload.php',
                        maxFileSize: 3000000,
                        onDragEnter: function(){
                          this.addClass('active');
                        },
                        onDragLeave: function(){
                          this.removeClass('active');
                        },
                        onNewFile: function(id, file){
                          ui_multi_add_file(id, file);
                        },
                        onBeforeUpload: function(id){
                          ui_multi_update_file_status(id, 'uploading', 'Uploading...');
                          ui_multi_update_file_progress(id, 0, '', true);
                        },
                        onUploadProgress: function(id, percent){
                          ui_multi_update_file_progress(id, percent);
                        },
                        onUploadSuccess: function(id, data){

                          if (data.status === 'ok' && data.file_name) {

                            var target_valu_new = $('#MediaSelectorTitle').data('target_input');
                            var filePath = data.file_name;

                            $.ajax({
                              url: 'inc/show-select-image-preview.php',
                              type: 'POST',
                              data: {
                                target_valu_new : target_valu_new,
                                filePath: filePath
                              },
                              success: function (response) {
                                $('#MoreGetPost').prepend(response);
                              },
                            });

                          }
                          ui_multi_update_file_status(id, 'success', 'Select File');
                          ui_multi_update_file_progress(id, 100, 'success', false);
                        },
                        onUploadError: function(id, xhr, status, message){
                          ui_multi_update_file_status(id, 'danger', message);
                          ui_multi_update_file_progress(id, 0, 'danger', false);
                        },
                        onFileSizeError: function(file){
                          alert('File \'' + file.name + '\' cannot be added: size excess limit', 'danger');
                        }
                      });
                    });
                    </script>
                    <div id="drag-and-drop-zone" class="dm-uploader p-5 text-center">
                      <h3 class="text-muted fs-4">Drop files to upload</h3>
                      <p class="m-0">or</p>
                      <div class="btn btn-sm btn-outline-primary mt-2">
                          <span>Select Files</span>
                          <input type="file" title='Click to add Files' />
                      </div>
                      <p class="mb-0 mt-2 fs-small">Maximum upload file size: 3 MB.</p>
                    </div>
                  </div>
                  <div class="col-12 mt-3" id="files"></div>
                </div>
                <script type="text/html" id="files-template">
                  <div class="upload_list media-body mb-2">
                    <p class="mb-2">
                      <strong>%%filename%%</strong> - <span class="text-muted">Waiting</span>
                    </p>
                    <div class="progress mb-1">
                      <div class="progress-bar progress-bar-striped progress-bar-animated bg-primary"
                        role="progressbar"
                        style="width: 0%"
                        aria-valuenow="0" aria-valuemin="0" aria-valuemax="100">
                      </div>
                    </div>
                  </div>
                </script>
              </div>
            </div>
            <div class="col-lg-8">
              <div id="AllMedia" class="p-2"></div>
              <div class="loader_image col-md-12 text-center py-4" style="display: none;"><img src="assets/img/loading.gif" style=" height:40px;"></div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
<?php endif; ?>
