<?php
/***
Auth: Aarti ojha
Description: Display category
*/ ?><div class="style2-table">
  <div class="style-title">
      <h3>Category</h3>
      <div class="row">
          <?php $new_category = base64_encode('new_category');?>
          <div class="col-sm-2" style="text-align: end;">
            <a href="admin_index.php?token=<?php echo $new_category;?>" class="button-orange1">New Category</a>
          </div>
      </div>
  </div>
<div id="success"></div>
      <form name="frmService" action="" method="post">
          <div class="table" id="SRallview">
              <table class="tableview tableview-2" id="admin_table">
                    <thead>
                      <tr class="background">
                      <td align="left">S.No.</td>
                      <td align="left">Category Name</td>
                      <td align="left">Type</td>
                      <td align="left">Created On</td>
                      <td align="left">Action</td>
                      </tr>
                    </thead>
                    <tbody>
                      <?php
                      $sql_document = category_view();                       
                      $numrow = mysqli_num_rows($sql_document);               
                      if ($numrow == 0){
                        $message = "No record Found!";
                        echo '<tr><td colspan=6 align="right" class="contentred"><img src=images/no_records.jpg>&nbsp;' . $message . '</td></tr>';
                      }else{
                          $count=1;
                          while($row_doc = mysqli_fetch_array($sql_document)){
                              $ICategoryID = $row_doc['id'];
                              $VCategoryName = $row_doc['category'];
                              $VCreatedBy = $row_doc['createdby'];
                              $ICreatedOn = $row_doc['createdon'];
                              $typename = $row_doc['type'];
                              $new_category = base64_encode('new_category');
                              $id = base64_encode($row_doc['id']);
                              ?>
                              <tr>
                                <td align="left"><?= $count ?></td>
                                <td align="left"><?= $VCategoryName ?></td>
                                <td align="left"><?= $typename ?></td>
                                <td align="left"><?= $ICreatedOn ?></td>
                                <td align="left">
                                  <a href="javascript:void(0)" onclick="window.location.href='admin_index.php?token=<?php echo $new_category;?>&id=<?= $id ?>';">
                                    <img src="<?=$SiteURL?>public/images/edit-icon.png" border="0" alt="Edit" />
                                  </a>
                                  <a href='javascript:void(0);' data-id="<?= $row_doc['id'] ?>" class="category_delete"><img src="<?=$SiteURL?>public/images/delete-icon.png" border="0"  alt="delete"></a> 
                                </td>
                              </tr>
                    <?php $count++; }  
                      }?>
                  </tbody>
              </table>
          </div>
      </form>
  </div>   