<?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="row">
    <div class="col-sm-8">
      <h1>AVV - Firma <?php echo $avv->getClientCompany($_GET['id']); ?></h1>
    </div>
    <div class="col-sm-4">
      <p class="text-right"><a href="create.php?id=<?php echo $_GET['id']; ?>"><button type="button" class="btn btn-success">Neue AVV <i class="fa fa-plus" aria-hidden="true"></i></button></a></p>
    </div>
  </div>
  
  <table class="table table-striped">
    <thead>
      <tr>
        <th>Nr</th>
        <th>Vertragsgegenstand</th>
        <th>Auftraggeber</th>
        <th>Auftragnehmer</th>
        <th></th>
        <th></th>
      </tr>
    </thead>
    <tbody>
      <?php
      foreach ($rows as $row) {
        
      ?>
      <tr>
        <td><?php echo $row['id']; ?></td>
        <td><?php echo showHtmlEntities($row['vertragsgegenstand']); ?></td>
        <td><?php echo showHtmlEntities($row['ansprechpartner_b_auftragnehmer']); ?></td>
        <td><?php echo showHtmlEntities($row['angaben_firma']); ?></td>
        <td><a href="edit.php?id=<?php echo $_GET['id']; ?>&avv_id=<?php echo $row['id']; ?>"><button type="button" class="btn btn-warning"><i class="fas fa-edit"></i></button></td>
        <td><a href="delete.php?id=<?php echo $_GET['id']; ?>&avv_id=<?php echo $row['id']; ?>" onClick="return secquest(this);"><button type="button" class="btn btn-danger"><i class="fas fa-trash"></i></button></a></td>
      </tr>
      <?php
      }
      ?>
    </tbody>
  </table>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/footer.php');
?>
<script>
function secquest(Formular)
{
  if(confirm("AVV löschen?")) {
    return true;
  } else {
    return false;
  }
}
</script>
</body>
</html>
