<!DOCTYPE html>
<html lang="en">

<head>
  <title>Call Firewall: Call Logs</title>
  <%- include('head.part'); %>
</head>

<body>
  <div class="container-lg">
    <h2>Call Firewall: Call Logs</h2>
    <%- include('sitemap.part'); %>
      <div class="table-responsive">
        <table class="table table-hover">
          <thead>
            <tr>
              <th>Date</th>
              <th>Time</th>
              <th>Number</th>
              <th>Name</th>
              <th></th>
              <th></th>
            </tr>
          </thead>
          <tbody>
            <% if(callData.length!=0){ var i=1; const tl=[ "table-primary" , "table-primary" , "table-primary"
              , "table-primary" , "table-primary" , "table-light" , "table-success" , "table-warning" , "table-warning"
              , "table-danger" ]; callData.forEach(function(data){ %>
              <tr class=<%=tl[data.threat_level]%> >
                <td>
                  <%=data.date.slice(0,2)+"/"+data.date.slice(2,4) %>
                </td>
                <td>
                  <%=data.time.slice(0,2)+":"+data.time.slice(2,4) %>
                </td>
                <td><a href="https://reportedcalls.com/<%=data.nmbr %>" class="btn btn-light btn-outline-dark btn-xs"
                    role="button">
                    <%=data.nmbr%>
                  </a></td>
                <td>
                  <%=data.name %>
                </td>
                <td><a href="/callid/block/insert/<%=data.nmbr%>" class="btn btn-danger btn-xs" role="button">Block</a>
                </td>
                <td><a href="/callid/allow/insert/<%=data.nmbr%>" class="btn btn-light btn-outline-dark btn-xs"
                    role="button">Add Contact</a></td>
              </tr>
              <% i++; }) %>
                <% } else{ %>
                  <tr>
                    <td colspan="6">No Data Found</td>
                  </tr>
                  <% } %>
          </tbody>
        </table>
      </div>
  </div>
</body>

</html>
