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

<div class="row">
  <div class="col-md-12">
    <ul class="nav nav-pills nav-pills-warning">
      <li class="nav-item">
        <a class="nav-link<?php if (!in_array($page1, array("support", "faq"))) echo ' active';?>" href="<?php echo JAK_rewrite::jakParseurl('departments');?>"><?php echo $jkl["hd2"];?></a>
      </li>
      <?php if (jak_get_access("support", $jakuser->getVar("permissions"), JAK_MAIN_OP)){?>
        <li class="nav-item">
          <a class="nav-link<?php if ($page1 == 'support') echo ' active';?>" href="<?php echo JAK_rewrite::jakParseurl('departments', 'support');?>"><?php echo $jkl["hd3"];?></a>
        </li>
      <?php } if (jak_get_access("faq", $jakuser->getVar("permissions"), JAK_MAIN_OP)){?>
        <li class="nav-item">
          <a class="nav-link<?php if ($page1 == 'faq') echo ' active';?>" href="<?php echo JAK_rewrite::jakParseurl('departments', 'faq');?>"><?php echo $jkl["hd4"];?></a>
        </li>
      <?php } ?>
    </ul>
    <hr>
  </div>
</div>

  <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_alt</i>
        </div>
        <h4 class="card-title "><?php echo ($page1 == 'faq' ? $jkl["hd291"] : $jkl["g98"]);?></h4>
      </div>
     <div class="card-body">

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

       <?php if (isset($DEPARTMENTS_ALL) && !empty($DEPARTMENTS_ALL)) { ?>
           <div class="table-responsive">
             <table class="table table-striped table-hover" id="sortTable">
              <thead>
               <tr>
                <th>#</th>
                <th><?php echo $jkl["g16"];?></th>
                <th><?php echo $jkl["g52"];?></th>
                <th><?php echo $jkl["g47"];?></th>
                <th><?php echo $jkl["g101"];?></th>
                <th><?php echo $jkl["g48"];?></th>
                <th><?php echo $jkl["g102"];?></th>
              </tr>
            </thead>
            <tfoot>
             <tr>
              <th>#</th>
              <th><?php echo $jkl["g16"];?></th>
              <th><?php echo $jkl["g52"];?></th>
              <th><?php echo $jkl["g47"];?></th>
              <th><?php echo $jkl["g101"];?></th>
              <th><?php echo $jkl["g48"];?></th>
              <th><?php echo $jkl["g102"];?></th>
            </tr>
          </tfoot>
          <tbody>
           <?php foreach($DEPARTMENTS_ALL as $v) { if ($v["subcat"] == $page3) { ?>
             <tr id="<?php echo $v["id"];?>">
               <td><?php echo $v["id"];?><input type="hidden" name="real_dep_id[]" value="<?php echo $v["id"];?>" /></td>
               <td class="title"><a href="<?php echo (!in_array($page1, array("support", "faq")) ? JAK_rewrite::jakParseurl('departments', 'edit', $v["id"]) : JAK_rewrite::jakParseurl('departments', $page1, 'edit', $v["id"]));?>"><?php echo $v["title"];?></a></td>
               <td class="desc"><?php echo $v["description"];?></td>
               <td><a class="btn btn-default btn-sm" href="<?php echo (!in_array($page1, array("support", "faq")) ? JAK_rewrite::jakParseurl('departments', 'edit', $v["id"]) : JAK_rewrite::jakParseurl('departments', $page1, 'edit', $v["id"]));?>"><i class="fa fa-pencil"></i></a></td>
               <td><?php if ($v["id"] != 1) { ?><a class="btn btn-default btn-sm" href="<?php echo (!in_array($page1, array("support", "faq")) ? JAK_rewrite::jakParseurl('departments', 'lock', $v["id"]) : JAK_rewrite::jakParseurl('departments', $page1, 'lock', $v["id"]));?>"><i class="fa fa-<?php if ($v["active"] == '1') { ?>check<?php } else { ?>lock<?php } ?>"></i></a><?php } ?></td>
               <td><?php if ($v["id"] != 1) { ?><a class="btn btn-danger btn-sm btn-confirm" href="<?php echo (!in_array($page1, array("support", "faq")) ? JAK_rewrite::jakParseurl('departments', 'delete', $v["id"]) : JAK_rewrite::jakParseurl('departments', $page1, 'delete', $v["id"]));?>" 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></a><?php } ?></td>
               <td><input type="number" name="corder[]" class="corder form-control" min="1" max="100" value="<?php echo $v["dorder"];?>" /></td>
             </tr>
           <?php } } ?>
         </tbody>
       </table>
     </div>

    <?php } else { ?>
    <div class="alert alert-info"><?php echo $jkl['i3'];?></div>
    <?php } ?>

   </div> 

   <div class="card-footer">
    <a href="<?php echo (!in_array($page1, array("support", "faq")) ? JAK_rewrite::jakParseurl('departments') : JAK_rewrite::jakParseurl('departments', $page1));?>" class="btn btn-default"><?php echo $jkl["g103"];?></a>
    <?php if (isset($DEPARTMENTS_ALL) && !empty($DEPARTMENTS_ALL)) { ?>
    <button type="submit" name="save" class="btn btn-primary"><?php echo $jkl["g38"];?></button>
    <?php } ?>
  </div>
</form>
</div>

</div>

</div>

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