<%- include('../../common/header') %> 
<%- include('../../common/side-bar') %>

<main class="main-content position-relative max-height-vh-100 h-100 border-radius-lg ">
    <%- include('../../common/navbar') %>
    <div class="container-fluid py-4">
      <div class="row">
        <div class="col-xl-12 col-sm-12 mb-xl-0 mb-4">
          <div class="card">
            <div class="card-header p-0 position-relative mt-n4 mx-3 z-index-2">
                <div class="bg-gradient-primary shadow-primary border-radius-lg pt-4 pb-3">
                  <h6 class="text-white text-capitalize ps-3">Authors</h6>
                </div>
              </div>
            <div class="card-body py-3 pb-2">
                <%- include('../../../errors/flash-message')  %>
                <a href="/authors/create" class="btn btn-sm btn-info" style="float: right;">Add New Author</a>
                <table class="table align-items-center justify-content-center mb-0">
                    <thead>
                        <tr>
                            <th>Id</th>
                            <th>Name</th>
                            <th>Image</th>
                            <th>Action</th>
                        </tr>
                    </thead>
                    <tbody>
                            
                              <% authors.forEach((element,key) => { %>
                                <tr>
                                  <td><%=key+1%></td>
                                  <td><%=element.name%></td>
                                  <td><%=element.image%></td>
                                  <td>
                                    <a href="/authors/edit/<%=element._id%>">Edit</a>
                                    <a href="/authors/delete/<%=element._id%>">Delete</a>
                                  </td>
                                  
                                </tr>
                               <%});%>
                    </tbody>
                </table>
            </div>
        </div>
        </div>
        </div>
    </div>
</main>


<%- include('../../common/footer') %> 