<?php
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/header.php');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/nav.php');
?>
<div class="container">
  <div class="card bg-light mb-3">
    <div class="card-header">
      <?php
      include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/headline.php');
      ?>
    </div>

    <div class="card-body">
      <table width="100%">
        <thead>
          <tr>
            <th height="40" width="50">Nr.</th>
            <th>Firma</th>
            <th>Name</th>
            <th>E-Mail</th>
            <th>Telefon</th>
            <th></th>
            <th></th>
            <th></th>
          </tr>
        </thead>

        <tbody>
        <?php
        $counter                = 1;
        foreach ($rows as $row) {
          if($tdColor                             == constant("TD_FIRST_COLOR")) {
            $tdColor                              = constant("TD_SECOND_COLOR");
          } else {
            $tdColor                              = constant("TD_FIRST_COLOR");
          }
          
        ?>
          <tr bgcolor="<?php echo $tdColor; ?>">
            <td height="40"><span class="badge badge-secondary"><?php echo $counter; ?></span></td>
            
            <td><?php echo showHtmlEntities($row['firma']); ?></td>
            <td><?php echo showHtmlEntities($row['name']); ?></td>
            <td><?php echo showHtmlEntities($row['email']); ?></td>
            
            <td><?php echo showHtmlEntities($row['tel']); ?></td>
            
            
            <td width="40">
              <a href="change-pw.php?id=<?php echo $row['uuid']; ?>">
                <strong><font color="#2E64FE" size="+1">
                  <span class="fas fa-key" data-toggle="tooltip" data-placement="left" title="Kundenpasswort ändern">&nbsp;</span>
                </font></strong>
              </a>
            </td>

            <td width="40">
              <a href="edit.php?id=<?php echo $row['uuid']; ?>">
                <strong><font color="#F2AE43" size="+1">
                  <span class="fas fa-user-edit" data-toggle="tooltip" data-placement="left" title="Kundendaten ändern">&nbsp;</span>
                </font></strong>
              </a>
            </td>
            
            <td width="40">
              <a href="delete.php?id=<?php echo $row['uuid']; ?>">
                <strong><font color="#FF0000" size="+1">
                  <span class="fas fa-trash" data-toggle="tooltip" data-placement="left" onClick="return secquest(this);" title="Kunden deaktivieren">&nbsp;</span>
                </font></strong>
              </a>
            </td>
            
          </tr>
        <?php
          $counter++;
        }
        ?>
      </table>
    </div>
  </div>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/footer.php');
?>
<script>
function secquest(Formular)
{
  if(confirm("Kunde löschen?")) {
    return true;
  } else {
    return false;
  }
}
</script>
</body>
</html>


