<?php if (JAK_USERID) { ?>

</div>
</div>

<footer class="footer">
        <div class="container-fluid">
          <nav class="float-left">
            <ul>
              <?php if (jak_get_access("support", $jakuser->getVar("permissions"), JAK_MAIN_OP)){?>
              <li>
                <a href="<?php echo JAK_rewrite::jakParseurl('support');?>">
                  <?php echo $jkl["hd"];?>
                </a>
              </li>
              <?php } if (jak_get_access("leads", $jakuser->getVar("permissions"), JAK_MAIN_OP)){?>
              <li>
                <a href="<?php echo JAK_rewrite::jakParseurl('leads');?>">
                  <?php echo $jkl["m1"];?>
                </a>
              </li>
              <?php } if (jak_get_access("off_all", $jakuser->getVar("permissions"), JAK_MAIN_OP)){?>
              <li>
                <a href="<?php echo JAK_rewrite::jakParseurl('contacts');?>">
                  <?php echo $jkl["m22"];?>
                </a>
              </li>
          <?php } ?>
              <li>
                <a href="<?php echo JAK_rewrite::jakParseurl('tickets')?>">
                  <?php echo $jkl["m31"]?>
                </a>
              </li>
            </ul>
          </nav>
          <div class="copyright float-right">
            &copy;
           <?php echo DATE("Y");?>, made with <i class="material-icons">favorite</i> by
            <a href="https://jakweb.ch/cloud-desk-3" target="_blank">JAKWEB</a>.
          </div>
        </div>
      </footer>

</div>
</div>

<?php } else { ?>


  <footer class="footer">
        <div class="container">
          <nav class="float-left">
            <ul>
              <li>
                <a href="<?php echo SIGN_UP_URL;?>">SignUp</a>
              </li>
              <li>
                <a href="<?php echo SIGN_UP_URL;?>">
                  About Us
                </a>
              </li>
              <li>
                <a href="<?php echo SIGN_UP_URL;?>">
                  FAQ
                </a>
              </li>
              <li>
                <a href="<?php echo SIGN_UP_URL;?>">
                  Pricing
                </a>
              </li>
            </ul>
          </nav>
          <div class="copyright float-right">
            <a href="https://jakweb.ch/cloud-desk-3">Made with <i class="material-icons">favorite</i> by Cloud Desk 3</a>
          </div>
        </div>
      </footer>
    </div>
 </div>


<?php } if (JAK_USERID) { ?>

<!-- Modal -->
<div id="jakModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="userModal" aria-hidden="true"><div class="modal-dialog modal-lg"><div class="modal-content"></div></div></div><!-- /.modal -->

<!-- New Pro Active Invitation -->
<div id="proActiveModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="proActiveModal" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h4 class="modal-title"><?php echo $jkl["u12"];?></h4>
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
      </div>
      <div class="modal-body">
      <input type="text" name="proactivemsg" id="proactivemsg" class="form-control" value="<?php echo $jakuser->getVar("invitationmsg"); ?>">
      <input type="hidden" name="proactiveuid" id="proactiveuid">
    </div>
    <div class="modal-footer">
      <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo $jkl["g103"];?></button>
      <button class="btn btn-primary" onclick="sendInvitation();"><?php echo $jkl["g4"];?></button>
    </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<?php if ($page == "") { ?>
<!-- Calendar Modal -->
<div class="modal fade" id="calModal" tabindex="-1" role="dialog" aria-labelledby="calModalLabel" aria-hidden="true">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="calModalLabel"></h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <form method="post" class="jak_form" action="<?php echo BASE_URL;?>ajax/calendar.php">
          <div class="row">
            <div class="col-md-6">
              <div class="form-group bmd-form-group">
                  <label for="cal-start" class="label-control"><?php echo $jkl['hd243'];?></label>
                  <input type="text" class="form-control datetimepicker" id="cal-start" name="cal-start">
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group bmd-form-group">
                  <label for="cal-end" class="label-control"><?php echo $jkl['hd244'];?></label>
                  <input type="text" class="form-control datetimepicker" id="cal-end" name="cal-end">
               </div>
            </div>
        </div>
            <div class="form-group bmd-form-group">
              <label for="cal-title" class="label-control"><?php echo $jkl['g16'];?></label>
              <input type="text" class="form-control" id="cal-title" name="cal-title">
            </div>
            <div class="form-group bmd-form-group">
              <label for="cal-content" class="label-control"><?php echo $jkl['g321'];?></label>
              <textarea class="form-control" id="cal-content" rows="5" name="cal-content"></textarea>
            </div>
            <div class="form-group bmd-form-group">
              <select name="cal-color" class="selectpicker col-12" title="<?php echo $jkl['cw12'];?>" id="color">
          <option style="color:#0071c5;" value="#0071c5">&#9724; Blue</option>
          <option style="color:#008000;" value="#008000">&#9724; Green</option>              
          <option style="color:#FFD700;" value="#FFD700">&#9724; Yellow</option>
          <option style="color:#FF8C00;" value="#FF8C00">&#9724; Orange</option>
          <option style="color:#FF0000;" value="#FF0000">&#9724; Red</option>
          <option style="color:#000000;" value="#000000">&#9724; Black</option>
        </select>
      </div>

      <div class="form-check" id="cal-delete">
          <label class="form-check-label">
              <input type="checkbox" class="form-check-input" name="cal-delete" value="1"> <?php echo $jkl['g48'];?>
              <span class="form-check-sign">
                    <span class="check"></span>
                  </span>
                </label>
        </div>
      </div>
      <div class="modal-footer">
        <div class="text-left">
        <button class="btn btn-default" data-dismiss="modal"><?php echo $jkl['g180'];?></button>
        </div>
        <button type="submit" class="btn btn-primary"><?php echo $jkl['g38'];?></button>
      </div>
      <input type="hidden" name="cal-id" id="cal-id">
      <input type="hidden" name="cal-action" id="cal-action">
      </form>
    </div>
  </div>
</div>
<?php } ?>

<!-- Modal FileManager -->
<div id="jakFM" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="userModal" aria-hidden="true"><div class="modal-dialog modal-xl"><div class="modal-content"><iframe src="<?php echo BASE_URL_ORIG;?>js/editor/filemanager/dialog.php?type=1&amp;lang=en_EN&amp;field_id=previmg" height="600" frameborder="0"></iframe></div></div></div><!-- /.modal -->

<?php } ?>

<script src="<?php echo BASE_URL_ORIG;?>js/jquery.js?=<?php echo JAK_UPDATED;?>"></script>
<script src="<?php echo BASE_URL;?>js/material-design.js?=<?php echo JAK_UPDATED;?>"></script>

<script src="<?php echo BASE_URL;?>js/combined.min.js"></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support SweetAlert -->
<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>
<!-- Run the show -->
<script src="<?php echo BASE_URL;?>js/admin.js?=<?php echo JAK_UPDATED;?>"></script>

<?php if ($jkl["rtlsupport"]) { ?>
<!-- RTL Support -->
<script src="https://cdn.rtlcss.com/bootstrap/v4.5.3/js/bootstrap.min.js" integrity="sha384-54+cucJ4QbVb99v8dcttx/0JRx4FHMmhOWi4W+xrXpKcsKQodCBwAvu3xxkZAwsH" crossorigin="anonymous"></script>
<!-- End RTL Support -->
<?php } ?>

<?php if (JAK_USERID) { ?>
<script src="<?php echo BASE_URL;?>js/client.ajax.js"></script>

<script>
  ls.usrAvailable = <?php echo $jakuser->getVar("available");?>;
  ls.ls_ringing = "<?php echo $jakuser->getVar("ringing");?>";
  ls.opid = <?php echo $jakuser->getVar("id");?>;
  ls.oname = '<?php echo stripcslashes($jakuser->getVar("username"));?>';
  // Push Notifications
  ls.pushnotify = <?php echo $jakuser->getVar("push_notifications");?>;  
  // sound
  ls.muted = <?php echo $jakuser->getVar("sound");?>;  
  // Chat latency
  clatency = <?php echo $jakuser->getVar("chat_latency");?>;
  
  $("#jakModal").on("show.bs.modal", function(e) {
      var link = $(e.relatedTarget);
      $(this).find(".modal-content").load(link.attr("href"));
  });
    
  $('#jakModal').on('hidden.bs.modal', function() {
    $(this).removeData();
  });

  ls.main_url = "<?php echo BASE_URL_ADMIN;?>";
  ls.orig_main_url = "<?php echo BASE_URL_ORIG;?>";
  ls.main_lang = "<?php echo JAK_LANG;?>";

  // Finally start the event.
  sseJAK(<?php echo $jakuser->getVar("id");?>, <?php echo $jakuser->getVar("operatorlist");?>, <?php echo $JAK_UONLINE;?>);
  setInterval("setTimer(<?php echo $jakuser->getVar("id");?>);", 120000);
</script>
<!-- Operator Chat -->
<?php if ($jakuser->getVar("operatorchat") == 1 && JAK_OPENOP == 0){?>

<script src="<?php echo BASE_URL;?>js/operator.chat.js"></script>

<script>
  sseJAKOPC(<?php echo $jakuser->getVar("id");?>);
</script>

<!-- reopen old opened chatboxes with the last state-->
<?php if (isset($_SESSION['chatbox_status'])) {
  echo '<script>';
  echo '$(function() {';
  foreach ($_SESSION['chatbox_status'] as $openedchatbox) {
    echo 'PopupChat('.$openedchatbox['partner_id'].',"'.$openedchatbox['partner_username'].'",'.$openedchatbox['chatbox_status'].');';
  }
  echo "});";
  echo '</script>';
  }

} ?>
<?php } ?>

<script>
<?php if (isset($_SESSION["infomsg"])) { ?>
md.showNotification('info', '<?php echo addslashes($_SESSION["infomsg"]);?>', 'info', 'top', 'right');
<?php } if (isset($_SESSION["successmsg"])) { ?>
md.showNotification('check', '<?php echo addslashes($_SESSION["successmsg"]);?>', 'success', 'top', 'right');
<?php } if (isset($_SESSION["errormsg"])) { ?>
md.showNotification('warning', '<?php echo addslashes($_SESSION["errormsg"]);?>', 'danger', 'top', 'right');
<?php } ?>
</script>

<?php if ($js_file_footer) include_once(APP_PATH.JAK_OPERATOR_LOC.'/template/'.$js_file_footer);?>

</body>
</html>
