<?php include_once 'header.php';?>

<div class="row">
  <div class="col-md-12">
    <div class="text-right"><a href="javascript:" id="ticket_stats_toggle" class="btn btn-info"><i class="fa fa-chart-pie"></i></a></div>
  </div>
</div>
<div id="ticket_stats" style="display:none">
<!-- Small boxes (Stat box) -->
<div class="row">
<div class="col-md-6">
  <div class="card card-stats">
    <div class="card-header card-header-info card-header-icon">
      <div class="card-icon">
        <i class="material-icons">assignment</i>
      </div>
      <p class="card-category"><?php echo $jkl["hd135"];?></p>
      <h3 class="card-title"><?php echo $totalAll;?></h3>
    </div>
    <div class="card-footer">
    </div>
  </div>
</div>
<div class="col-md-6">
  <div class="card card-stats">
    <div class="card-header card-header-primary card-header-icon">
      <div class="card-icon">
        <i class="material-icons">stars</i>
      </div>
      <p class="card-category"><?php echo $jkl["stat_s7"];?></p>
      <h3 class="card-title"><?php echo ($total_voted ? round($total_vote / $total_voted, 1).'/5' : '-');?></h3>
    </div>
    <div class="card-footer">
    </div>
  </div>
</div>
</div>
<div class="row">
<?php if (isset($totalTStat) && !empty($totalTStat)) foreach ($totalTStat as $v) { ?>
    <div class="col">
      <div class="card card-stats">
        <div class="card-header card-header-<?php echo $v["class"];?> card-header-icon">
          <div class="card-icon">
            <i class="material-icons">drafts</i>
          </div>
          <p class="card-category"><?php echo $v["title"];?></p>
          <h3 class="card-title"><?php echo $v["total"];?></h3>
        </div>
        <div class="card-footer">
        </div>
      </div>
    </div>
    <?php } ?>
</div>
</div>

<?php if (!$supportaccess) { ?>
<div class="alert alert-rose"><?php echo $jkl['i13'];?></div>
<?php } else { ?>

<form method="post" class="jak_form" action="<?php echo $_SERVER['REQUEST_URI'];?>">

  <div class="row">
    <div class="col-md-3">
      <p><a class="btn btn-primary" href="<?php echo JAK_rewrite::jakParseurl('support', 'new');?>"><?php echo $jkl["hd166"];?></a></p>
    </div>
    <div class="col-md-3">
      <?php if (isset($dep_filter) && is_array($dep_filter) && !empty($dep_filter)) { ?>
        <h4><?php echo $jkl['hd328'];?></h4>
        <select name="jak_depid" id="jak_depid" class="selectpicker col-12">
          <option value="0"><?php echo $jkl['g105'];?></option>
          <?php foreach ($dep_filter as $v) { ?>
            <option value="<?php echo $v["id"];?>"<?php if (isset($_SESSION["sortdepid"]) && $_SESSION["sortdepid"] == $v["id"]) echo ' selected';?>><?php echo $v["title"];?></option>
          <?php } ?>
        </select>
      <?php } ?>
    </div>
    <div class="col-md-3">
    <?php if (isset($op_filter) && is_array($op_filter) && !empty($op_filter)) { ?>
      <h4><?php echo $jkl['hd346'];?></h4>
        <select name="jak_opid" id="jak_opid" class="selectpicker col-12">
          <option value="0"><?php echo $jkl['g105'];?></option>
          <?php foreach ($op_filter as $o) { ?>
          <option value="<?php echo $o["id"];?>"<?php if (isset($_SESSION["sortopid"]) && $_SESSION["sortopid"] == $o["id"]) echo ' selected';?>><?php echo $o["username"];?></option>
          <?php } ?>
        </select>
      <?php } ?>
    </div>
    <div class="col-md-3">
      <?php if (isset($HD_SUPPORT_STATUS) && !empty($HD_SUPPORT_STATUS)) { ?>
        <h4><?php echo $jkl['hd25'];?></h4>
        <select name="jak_statuschange" id="jak_statuschange" class="selectpicker col-12" title="<?php echo $jkl['hd25'];?>">
          <?php foreach ($HD_SUPPORT_STATUS as $s) { ?>
            <option value="<?php echo $s["id"];?>"><?php echo $s["title"];?></option>
          <?php } ?>
        </select>
      <?php } ?>
    </div>
  </div>

  <?php if (isset($totalAll) && $totalAll != 0) { ?>

    <div class="row">
      <div class="col-md-12">
        <div class="card">
          <div class="card-header card-header-icon card-header-rose">
            <div class="card-icon">
              <i class="material-icons">list</i>
            </div>
            <h4 class="card-title "><?php echo $jkl['m31'];?></h4>
          </div>
          <div class="card-body">

            <div class="row">
              <div class="col-md-11">
                <?php if (isset($HD_SUPPORT_STATUS) && !empty($HD_SUPPORT_STATUS)) { ?>
                  <h4><?php echo $jkl['hd322'];?></h4>
                  <a href="<?php echo JAK_rewrite::jakParseurl('support', 'statusfilter');?>" class="badge badge-default"><?php echo $jkl['g105'];?></a>
                  <?php foreach ($HD_SUPPORT_STATUS as $st) {
                    echo ' <a href="'.JAK_rewrite::jakParseurl('support', 'statusfilter', $st["id"]).'" class="badge badge-'.$st["class"].'">'.$st["title"].'</a>';
                  } } ?>
                </div>
                <div class="col-md-1 text-center">
                  <h4><?php echo $jkl['g48'];?></h4>
                  <button class="badge badge-danger btn-confirm" data-action="delete" data-title="<?php echo addslashes($jkl["g48"]);?>" data-text="<?php echo addslashes($jkl["e30"]);?>" data-type="warning" data-okbtn="<?php echo addslashes($jkl["g279"]);?>" data-cbtn="<?php echo addslashes($jkl["g280"]);?>"><i class="fa fa-trash-alt"></i></button>
                </div>
              </div>

              <hr>

              <table id="dynamic-data" class="table table-striped" cellspacing="0" width="100%">
                <thead>
                  <tr>
                    <th><input type="checkbox" id="jak_delete_all"></th>
                    <th>#<?php echo $jkl['hd247'];?></th>
                    <th><?php echo $jkl["g16"];?></th>
                    <th><?php echo $jkl["g131"];?></th>
                    <th><?php echo $jkl["hd77"];?></th>
                    <th><?php echo $jkl["hd172"];?></th>
                    <th><i class="fa fa-paperclip" title="<?php echo $jkl["hd168"];?>"></i></th>
                    <th><i class="fa fa-star" title="<?php echo $jkl["g85"];?>"></i></th>
                    <th><?php echo $jkl["hd167"];?></th>
                    <th><?php echo $jkl["g174"];?></th>
                  </tr>
                </thead>
              </table>

            </div>
          </div>
        </div>
      </div>

    <?php } else { ?>

      <div class="alert alert-rose">
        <?php echo $jkl['i3'];?>
      </div>

    <?php } ?>

    <input type="hidden" name="action" id="action">
  </form>

<?php } ?>

<?php include_once 'footer.php';?>
