<!DOCTYPE html>
<html lang="en">
  
<head>
    <%- include('./partials/head'); -%>
</head>
<body onload="startTime()">
    <%- include('./partials/header_sidebar'); -%>
    
    <!-- tap on top starts-->

    <!-- Page Sidebar Ends-->
    <div class="page-body">
      <div class="container-fluid">
        <div class="page-title">
          <div class="row">
            <div class="col-sm-6">
              <h3><%=lan.customer%> <%=lan.list%></h3>
            </div>
            <div class="col-sm-6">
              <ol class="breadcrumb">
                <li class="breadcrumb-item"><a href="/index"><i data-feather="home"></i></a></li>
                <li class="breadcrumb-item"><%=lan.dashboard%></li>
                <li class="breadcrumb-item active"><%=lan.customer%> <%=lan.list%></li>
              </ol>
            </div>
          </div>
        </div>
      </div>
      <!-- Container-fluid starts-->
      <div class="container-fluid">
        <div class="row">
            <div class="col-sm-12">
                <div class="card">
                    <% let permiss = per != "1" ? per.customer[1] : "1" %>
                    <% if(permiss == "1"){ %>
                    <div class="card-header d-flex justify-content-end pb-0">
                        <a class="btn btn-square btn-primary b-r-10" type="button" href="/customer/add"><%=lan.add%> <%=lan.customer%></a>
                    </div>
                    <% } %>
                    <div class="card-body">
                        <div class="table-responsive theme-scrollbar">
                            <table class="display" id="basic-1">
                                <thead>
                                    <tr>
                                        <th>#</th>
                                        <th><%=lan.name%></th>
                                        <th><%=lan.email%></th>
                                        <th><%=lan.phone_number%></th>
                                        <th><%=lan.status%></th>
                                        <th><%=lan.chat%></th>
                                        <% let permissions = per != "1" ? per.customer[2] : "1" %>
                                        <% if(permissions == "1"){ %>
                                        <th><%=lan.action%></th>
                                        <% } %>
                                    </tr>
                                </thead>
                                <tbody>
                                    <% var i = 1 %>
                                    <% customer_list.forEach((data) => { %>
                                        <tr>
                                            <td><%= i %></td>
                                            <td><%= data.name %></td>
                                            <td><%= data.email %></td>
                                            <td><%= data.country_code %> <%= data.phone %></td>
                                            <td>
                                                <% if (data.status == '1') { %>
                                                    <span class="badge badge-success"><%=lan.active%></span>
                                                <% } else { %>
                                                    <span class="badge badge-danger"><%=lan.deactive%></span>
                                                <% } %>
                                            </td>
                                            <td>
                                                <a href="/customer/chat/<%= data.id %>"><span class="badge badge-primary" style="padding: 4px 15px 4px 15px;"><i class="fa fa-comments-o f-18"></i></span></a>
                                            </td>
                                            <% if(permissions == "1"){ %>
                                            <td> 
                                                <ul class="action"> 
                                                    <li class="text-primary"><a href="/customer/profile/<%= data.id %>"><i class="icon-user f-14"></i></a></li>
                                                    <li class="edit" style="margin-left: 8px;"> <a href="/customer/edit/<%= data.id %>"><i class="icon-pencil-alt"></i></a></li>
                                                    <li class="delete"><a href="/customer/delete/<%= data.id %>"><i class="icon-trash"></i></a></li>
                                                </ul>
                                            </td>
                                            <% } %>
                                        </tr>
                                    <% i++ %>
                                    <% }) %>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
      </div>
      <!-- Container-fluid Ends-->
    </div>

<%- include('./partials/footer'); -%>
<%- include('./partials/script'); -%>

</body>
</html>
