<html lang="en">

<%- include('../partials/header.ejs'); %>

  <body>

    <div class="container-scroller">

      <%- include ('../partials/nav.ejs') %>


        <div class="container-fluid page-body-wrapper">

          <%- include ('../partials/theme-setting') %>


            <%- include('../partials/sidebar.ejs') %>

              <div class="main-panel">
                <div class="content-wrapper p-0">

                  <div class="welcome-message">
                    <div class="d-lg-flex justify-content-between align-items-center">
                      <div class="pl-4">
                        <h2 class="text-white font-weight-bold mb-1"> Type List</h2>
                      </div>
                    </div>
                  </div>


                  <div class="content-wrapper">
                    <div class="card">
                      <div class="card-body">
                        <div class="row">
                          <div class="col-12">
                            <div class="table-responsive">
                              <table id="order-listing" class="table">
                                <thead>
                                  <tr>
                                    <th>#</th>
                                    <th>Title</th>
                                    <th> Details</th>
                                    <th> Status</th>
                                    <th>Actions</th>
                                  </tr>
                                </thead>
                                <tbody>
                                  <% for(let i=0; i < data.length; i++) { %>
                                  <tr>
                                    <td>1</td>
                                    <td> <%= data[i].title %></td>
                                    <td><%= data[i].details %></td>
                                    <td>
                                      <% if(data[i].status==1){ %> Active <% }
                                       else if (data[i].status==2) { %> Disable <% } 
                                       else { %> Delete <% } %>
                                    </td>
                                    <td>
                                      <% if(data[i].status !== 0){ %>
                                        <a class="btn btn-outline-primary"href="<%= url %>price-type/edit/<%= data[i].id %>">Edit</a>
                                        <a class="btn btn-outline-primary"href="<%= url %>price-type/statusChange/<%= data[i].id %>">Change active status</a>
                                        <a class="btn btn-outline-primary"href="<%= url %>price-type/delete/<%= data[i].id %>" onclick="return confirm('Are you sure you want to delete this item?');" >Delete Type</a>
                                      <% } %>
                                    </td>
                                  </tr>
                                  <% } %>
                                 
                                </tbody>
                              </table>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>

                </div>
                <%- include ('../partials/footer.ejs'); %>

              </div>
        </div>
    </div>

    <%- include('../partials/footer_js.ejs'); %>

  </body>

</html>