<?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 border-primary mb-3">
    <div class="card-header">
      <h1 class="text-center">VVT - <?php echo $vvt->getClientCompany($_GET['id']); ?></h1>
      
    </div>
    <div class="card-body">
      <form name="jump" action="<?php echo$_SERVER['PHP_SELF']; ?>" method="get">
      <div class="row">
        <div class="form-group col-sm-3">
          Themenblock
        </div>
        <div class="form-group col-sm-7">
          <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
          <select name="vvt_id" id="themenblock_id" class="form-control" onchange="jump.submit()" required>
            <option value="">Bitte auswählen</option>
            <?php
            foreach ($rowsDropdownThemenblock as $rowDD) {
              echo '<option value="' . $rowDD["Vvt_vvt_id"] . '">' . showHtmlEntities($rowDD["TB_Name"].' - FrageID '.$rowDD["Vvt_vvt_id"]) . '</option>';
            }
            ?>
          </select>
        </div>
      </div>
      </form>
      <div class="row">
        <h3>Frage ID: <?php echo $row['vvt_id']; ?> | Themenblock: <?php echo showHtmlEntities($vvt->getVvtThemenblockName($row['themenblock_id'])); ?></h3>
      </div>
      <div class="row">
        <div class="col-sm-3 form-group">
          &nbsp;
          <p><span class="badge badge-secondary" style="font-size:20px;"><?php echo $_GET['vvt_id']; ?></span>
            <?php
            if ($previousQuest    >= 1) {
            ?>
            <a href="edit.php?id=<?php echo $_GET['id']; ?>&vvt_id=<?php echo $previousQuest; ?>&vvt=VVT"><button type="button" class="btn btn-success">zurück</button></a>
            <?php
            }
            ?>
            <?php
            if ($nextQuest        >= 1) {
            ?>
            <a href="edit.php?id=<?php echo $_GET['id']; ?>&vvt_id=<?php echo $nextQuest; ?>&vvt=VVT"><button type="button" class="btn btn-success">Weiter</button></a>
            <?php
            }
            ?>
          </p>
        </div>
        <div class="col-sm-3 form-group">
          &nbsp;
          <?php
          if ($row['is_report']       == 0) {
          ?>
          <p><a href="set-to-kunden.php?id=<?php echo $_GET['id']; ?>&id_vvt=<?php echo $row['id']; ?>"><button type="button" class="btn btn-info">VVT zum Kunden hinzufügen</button></a></p>
          <?php
          } else {
            echo '<div class="alert alert-danger" role="alert">VVT ist bereits selektiert!</div>';
          }
          ?>
        </div>
        <div class="col-sm-3 form-group">
          &nbsp;
          <?php
          if ($amountSelectedQuests   >= 1) {
          ?>
          <p><a href="edit-selected.php?id=<?php echo $_GET['id']; ?>"><button type="button" class="btn btn-warning">Selektierte VVT anzeigen</button></a></p>
          <?php
          } else {
            echo '<div class="alert alert-danger" role="alert">Keine selektierten VVT vorhanden!</div>';
          }
          ?>
        </div>
        <div class="col-sm-2 form-group">
          &nbsp;
          <p><a href="print.php?id=<?php echo $_GET['id']; ?>" target="_blank"><button type="button" class="btn btn-info">Bericht HF<i class="far fa-file-pdf"></i></button></a></p>
        </div>
        <div class="col-sm-1 form-group">
          &nbsp;
          <p class="text-right"><a href="delete.php?id=<?php echo $_GET['id']; ?>&id_vvt=<?php echo $row['id']; ?>" onClick="return secquest(this);"><button type="button" class="btn btn-danger"><i class="fas fa-trash"></i></button></a></p>
        </div>
      </div>
      <form name="edit" action="<?php echo$_SERVER['PHP_SELF']; ?>" method="POST">
      <div class="row">
        <div class="form-group col-sm-3">
          <input type="hidden" name="site" value="<?php echo $site; ?>">
          <input type="hidden" name="id" value="<?php echo $_GET['id']; ?>">
          <input type="hidden" name="id_vvt" value="<?php echo $row['id']; ?>">
          <input type="hidden" name="vvt_id" value="<?php echo $_GET['vvt_id']; ?>">
          <input type="hidden" name="site" value="<?php echo$_SERVER['PHP_SELF']; ?>?id=<?php echo $_GET['id']; ?>&vvt_id=<?php echo $_GET['vvt_id']; ?>">
          <input type="hidden" name="themenblock_id" value="<?php echo $row['themenblock_id']; ?>">
          <label for="vvt_name">Verfahrensname (Nr. <?php echo $_GET['vvt_id']; ?>)</label>
        </div>
        <div class="form-group col-sm-7">
          <input type="text" name="vvt_name" id="vvt_name" class="form-control" value="<?php echo showHtmlEntities($row['name']); ?>" required>
        </div>
        <div class="form-group col-sm-2">
          
        </div>
      </div>
      
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="verantwortliche_fachabteilung">Verantwortliche Fachabteilung: Ansprechpartner, Telefon, E-Mail (Art. 30 Abs. 1 S. 2 lit. a)::</label>
          <textarea name="verantwortliche_fachabteilung" id="verantwortliche_fachabteilung" class="form-control" rows="5"><?php echo showHtmlEntities($row['verantwortliche_fachabteilung']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="zweck">Zweck:</label>
          <textarea name="zweck" id="zweck" class="form-control" rows="5"><?php echo showHtmlEntities($row['zweck']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="beschr_warum_erlaubt">Beschreiben Sie, warum diese Datenverabeitung erfoderlich/erlaubt ist (Rechtsgundlage):</label>
          <textarea name="beschr_warum_erlaubt" id="beschr_warum_erlaubt" class="form-control" rows="5"><?php echo showHtmlEntities($row['beschr_warum_erlaubt']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="betr_personen">Beschreibung der Kategorien betroffener Personen: (Art. 30 Abs. 1 S. 2 lit. c):</label>
          <textarea name="betr_personen" id="betr_personen" class="form-control" rows="5"><?php echo showHtmlEntities($row['betr_personen']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="betr_daten_der_pers">Beschreibung der Kategorien von personenbezogenen Daten (Art. 30 Abs. 1 S. 2 lit. c):</label>
          <textarea name="betr_daten_der_pers" id="betr_daten_der_pers" class="form-control" rows="5"><?php echo showHtmlEntities($row['betr_daten_der_pers']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="weitergabe">Werden die Daten weitergegeben? Wenn ja, an wen? (Art. 30 Abs. 1 S. 2 lit. d):</label>
          <textarea name="weitergabe" id="weitergabe" class="form-control" rows="5"><?php echo showHtmlEntities($row['weitergabe']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="uebermittlung_laender">Übermittlung in Drittländer oder an internationale Organisationen (Art. 30 Abs. 1 S. 2 lit. e):</label>
          <textarea name="uebermittlung_laender" id="uebermittlung_laender" class="form-control" rows="5"><?php echo showHtmlEntities($row['uebermittlung_laender']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="aufbewahrungsfrist">Aufbewahrungsfristen / Wie lange müssen die Daten aufbewahrt werden? (Löschfristen):</label>
          <textarea name="aufbewahrungsfrist" id="aufbewahrungsfrist" class="form-control" rows="5"><?php echo showHtmlEntities($row['aufbewahrungsfrist']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="tom">TOM - Bitte beschreiben Sie, welche technischen und organisatorischen Maßnahmen zur Datensicherheit getroffen wurden:</label>
          <textarea name="tom" id="tom" class="form-control" rows="5"><?php echo showHtmlEntities($row['tom']); ?></textarea>
        </div>
      </div>
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="risiko_quellen_schaden">Risiko-Quellen / Möglicher Schaden:</label>
          <textarea name="risiko_quellen_schaden" id="risiko_quellen_schaden" class="form-control" rows="5"><?php echo showHtmlEntities($row['risiko_quellen_schaden']); ?></textarea>
        </div>
      </div>
      
      <div class="row">
        <div class="col-sm-12 form-group">
          <label for="ds_folge_schaetzung">Datenschutzfolgeabschätzung erfoderlich:</label>
          <textarea name="ds_folge_schaetzung" id="ds_folge_schaetzung" class="form-control" rows="5"><?php echo showHtmlEntities($row['ds_folge_schaetzung']); ?></textarea>
        </div>
      </div>
      
      <div class="row">
        <div class="col-sm-6 form-group">
          <label for="risiko_eintritt">Risiko: Eintrittswahrscheinlichkeit</label>
          <select name="risiko_eintritt" id="risiko_eintritt" class="form-control">
            <option value="">Risiko: Eintrittswahrscheinlichkeit auswählen</option>
            <?php
            foreach ($rowsDropdownRiskProbability as $key => $value) {
              echo '<option value="' . $value . '"';
              if ($row['risiko_eintritt']     == $value) {
                echo ' selected';
              }
              echo '>' . $value . ' - ' . $key . '</option>';
            }
            ?>
          </select>
        </div>
        <div class="col-sm-6 form-group">
        </div>
      </div>
      
      <div class="row">
        <div class="col-sm-6 form-group">
          <label for="risiko_schaden">Risiko: Schadenspotential</label>
          <select name="risiko_schaden" id="risiko_schaden" class="form-control">
            <option value="">Risiko: Schadenspotential auswählen</option>
            <?php
            foreach ($rowsDropdownRiskPotential as $key => $value) {
              echo '<option value="' . $value . '"';
              if ($row['risiko_schaden']      == $value) {
                echo ' selected';
              }
              echo '>' . $value . ' - ' . $key . '</option>';
            }
            ?>
          </select>
        </div>
        <div class="col-sm-6 form-group">
        </div>
      </div>
      
      <div class="row">
        <div class="col-sm-6 form-group">
          <label for="status">Status</label>
          <select name="status" id="status" class="form-control" required>
            <?php
            foreach ($rowsDropdownStatus as $key => $value) {
              echo '<option value="' . $value . '"';
              if ($row['status']                 == $value) {
                echo ' selected';
              }
              echo '>' . $value . ' - ' . $key . '</option>';
            }
            ?>
          </select>
        </div>
        <div class="col-sm-6 form-group">
          <p>&nbsp;</p>
          <p class="text-right"><input type="submit" name="submit_vvt" class="btn btn-warning" value="Änderungen der Frage <?php echo $row['vvt_id']; ?> speichern"></p>
        </div>
      </div>
      </form>
      
      <div class="row">
        <div class="col-sm-8 form-group">
          &nbsp;
          <p><span class="badge badge-secondary" style="font-size:20px;"><?php echo $_GET['vvt_id']; ?></span>
            <?php
            if ($previousQuest    >= 1) {
            ?>
            <a href="edit.php?id=<?php echo $_GET['id']; ?>&vvt_id=<?php echo $previousQuest; ?>&vvt=VVT"><button type="button" class="btn btn-success">zurück</button></a>
            <?php
            }
            ?>
            <?php
            if ($nextQuest        >= 1) {
            ?>
            <a href="edit.php?id=<?php echo $_GET['id']; ?>&vvt_id=<?php echo $nextQuest; ?>&vvt=VVT"><button type="button" class="btn btn-success">Weiter</button></a>
            <?php
            }
            ?>
          </p>
        </div>
        <div class="col-sm-4 form-group">
        </div>
      </div>
    </div>
  </div>
  
</div>

<p>&nbsp;</p>
<p>&nbsp;</p>
<?php
include($_SERVER['DOCUMENT_ROOT'] . HOME_DIR . TEMPLATE_DIR . '/footer.php');
?>
</body>
</html>



