<%- include('./admin_partials/header') -%>

    <link rel="stylesheet" href="/admin/admin.css">

 <br>
 <div class="section" id="categories">
     <div class="sect-head">
        <h3 class="section-t" data-content="categories-content">Categories:</h3>
        <a class="btn btn-success" href="/new/category">+Add new Category</a>    
     </div>
        <table id="categories-content" class="table">
        <thead>
          <tr>
            <th scope="col">#</th>
            <th scope="col">Categorie</th>
            <th scope="col">Delete</th>
            <th scope="col">Edit</th>
          </tr>
        </thead>
        <tbody>
<% cats.forEach(function(cat, indx){%>
<tr id="tr-cat-<%=indx%>">
    <td><%=indx+1%></td>
    <td id="catname-<%=indx%>"><a href="/sub_categories/<%=cat._id%>"><%=cat.name%></a></td>
    <td class="action delete" onclick="delete_category('<%=indx%>','<%=cat._id%>','<%=cat.name%>')"></td>
    <td class="action edit" onclick="edit(this,'<%=indx%>','<%=cat._id%>');" data-action="edit"></td>
</tr>
    <% })%>
            
        </tbody>
      </table>
 </div>

 

<script src="/admin/admin.js"></script> 
 <%- include('./admin_partials/footer') -%>