<?php
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/header.php');
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . '/Auth/nav.php');
?>
<form name="edit" action="<?php echo$_SERVER['PHP_SELF']; ?>" method="POST">
<div class="container">
  <div class="card border-primary mb-3">
    <div class="card-header">
      <h1>AVV - <?php echo $avv->getClientCompany($_GET['id']); ?> bearbeiten</h1>
      <input type="hidden" name="site" value="<?php echo $site; ?>">
      <input type="hidden" name="kunden_id" value="<?php echo $_GET['id']; ?>">
      <input type="hidden" name="avv_id" value="<?php echo $_GET['avv_id']; ?>">
    </div>
    <div class="card-body">
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="vertragsgegenstand">Vertragsgegenstand</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="vertragsgegenstand" id="vertragsgegenstand" class="form-control" value="<?php echo showHtmlEntities($row['vertragsgegenstand']); ?>" required>
        </div>
        <div class="form-group col-sm-2">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="ansprechpartner_b_auftragnehmer">Ansprechpartner bei Auftraggeber:</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="ansprechpartner_b_auftragnehmer" id="ansprechpartner_b_auftragnehmer" class="form-control" value="<?php echo showHtmlEntities($row['ansprechpartner_b_auftragnehmer']); ?>" required>
        </div>
        <div class="form-group col-sm-2">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_firma">Firma</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_firma" id="angaben_firma" class="form-control" value="<?php echo showHtmlEntities($row['angaben_firma']); ?>" required>
        </div>
        <div class="form-group col-sm-2">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_anrede">Anrede</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_anrede" id="angaben_anrede" class="form-control" value="<?php echo showHtmlEntities($row['angaben_anrede']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_titel">Titel</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_titel" id="angaben_titel" class="form-control" value="<?php echo showHtmlEntities($row['angaben_titel']); ?>">
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_vorname">Vorname</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_vorname" id="angaben_vorname" class="form-control" value="<?php echo showHtmlEntities($row['angaben_vorname']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_nachname">Nachname</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_nachname" id="angaben_nachname" class="form-control" value="<?php echo showHtmlEntities($row['angaben_nachname']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_str_nr">Straße, Nr</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_str_nr" id="angaben_str_nr" class="form-control" value="<?php echo showHtmlEntities($row['angaben_str_nr']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_plz">PLZ</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_plz" id="angaben_plz" class="form-control" value="<?php echo showHtmlEntities($row['angaben_plz']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_ort">Ort</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_ort" id="angaben_ort" class="form-control" value="<?php echo showHtmlEntities($row['angaben_ort']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_email">EMail</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_email" id="angaben_email" class="form-control" value="<?php echo showHtmlEntities($row['angaben_email']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="angaben_telefon">Telefon</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="angaben_telefon" id="angaben_telefon" class="form-control" value="<?php echo showHtmlEntities($row['angaben_telefon']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="bemerkung">Bemerkung</label>
          <textarea name="bemerkung" id="bemerkung" class="form-control" rows="5"><?php echo showHtmlEntities($row['bemerkung']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="rechtsgrundlage_f_d_datenverabeitung">Rechtsgrundlage für die Datenverabeitung</label>
        </div>
        <div class="form-group col-sm-7">
          <select name="rechtsgrundlage_f_d_datenverabeitung" id="rechtsgrundlage_f_d_datenverabeitung" class="form-control" required>
            <option value="">Bitte auswählen</option>
            <?php
            foreach ($rowsDropdownLegalBasis as $key => $value) {
              echo '<option value="' . $value . '"';
              if ($row['rechtsgrundlage_f_d_datenverabeitung']  == $value) {
                echo ' selected';
              }
              echo '>' . $value . ' - ' . $key . '</option>';
            }
            ?>
          </select>
        </div>
      </div>
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="stand_der_verhandung">Stand der Verhandlung</label>
        </div>
        <div class="form-group col-sm-7">
          <select name="stand_der_verhandung" id="stand_der_verhandung" class="form-control" required>
            <option value="">Bitte auswählen</option>
            <?php
            foreach ($rowsDropdownContract as $key => $value) {
              echo '<option value="' . $value . '"';
              if ($row['stand_der_verhandung']    == $value) {
                echo ' selected';
              }
              echo '>' . $value . ' - ' . $key . '</option>';
            }
            ?>
          </select>
        </div>
      </div>
      
      
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="vertragsform">Vertragsform</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="vertragsform" id="vertragsform" class="form-control" value="<?php echo showHtmlEntities($row['vertragsform']); ?>" required>
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="letzte_tom_pruefung">Letzte TOM Prüfung</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="letzte_tom_pruefung" id="letzte_tom_pruefung" class="form-control datepicker" value="<?php echo makeLocalDate($row['letzte_tom_pruefung'], "EN"); ?>">
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      
      <div class="row">
        <div class="form-group col-sm-2">
          <label for="zeichnungsdatum">Zeichnungsdatum</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="zeichnungsdatum" id="zeichnungsdatum" class="form-control datepicker" value="<?php echo makeLocalDate($row['zeichnungsdatum'], "EN"); ?>">
        </div>
        <div class="form-group col-sm-3">
        </div>
      </div>
      
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="gehoert_zu_verfahren">Gehört zu Verfahren</label>
          <textarea name="gehoert_zu_verfahren" id="gehoert_zu_verfahren" class="form-control" rows="5"><?php echo showHtmlEntities($row['gehoert_zu_verfahren']); ?></textarea>
        </div>
      </div>
      
    </div>
  </div>
  <?php 
    include ($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/forms/footer.edit.php');
  ?>
</div>
</form>
<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/footer.php');
?>
<script>
$('.datepicker').datepicker({
  format: 'dd-mm-yyyy',
  startDate: '-1y',
  startView: '0',
  todayHighlight: true,
  autoclose: true
})
</script>
</body>
</html>
