<?php
// include 'views/users/toolbar.php';
?>
<form action="./controllers/controller.php?folder=<?= $_GET['folder']; ?>" method="POST">
  <div class="form-group">
    <div class="row">
      <div class="col text-center">
        <i class="material-icons" style="font-size: 80px;">mail</i>
      </div>
    </div>
    <div class="row row_margin_top">
      <div class="col-2">
        <label class="font-weight-bold">Para</label>
      </div>
      <div class="col">
        <span><?= $_GET['nombre'] ?></span>
      </div>
    </div>
    <div class="row row_margin_top">
      <div class="col-2">
        <label for="emailDestination" class="font-weight-bold">Destino</label>
      </div>
      <div class="col">
        <input type="email" class="form-control" id="emailDestination" name="emailDestination" placeholder="Para" required value="<?= $_GET['correo']; ?>">
      </div>
    </div>
    <div class="row row_margin_top">
      <div class="col-2">
        <label for="emailSubject" class="font-weight-bold">Asunto</label>
      </div>
      <div class="col">
        <input type="text" class="form-control" id="emailSubject" name="emailSubject" placeholder="Para" required value="Arriendo Dpto - <?= $_GET['dpto']; ?> LagunaMar">
      </div>
    </div>
    <div class="row row_margin_top">
      <div class="col-2">
        <label for="emailBody" class="font-weight-bold">Mensaje</label>
      </div>
      <div class="col">
        <?php
        $newDate = date("d/m/Y", strtotime($_GET['fecin']));
        $newDate2 = date("d/m/Y", strtotime($_GET['fecout']));
        $ide = ($_GET['id']);
        $enlace = 'https://misarriendos.cl/agenda/EDITAR_PDF/Editar_PDF_CON_FPDI-master/asignar_variables_al_pdf2.php?variable1=' . $ide;
        ?>
        <input type="text" class="form-control" id="emailBody" name="emailBody" placeholder="Para" required value="Usted agendó un Arriendo Departamento Nº <?= $_GET['dpto']; ?> en LagunaMar Las Cruces - Agendado para el <?= $newDate; ?> - hasta el <?= $newDate2; ?> - Ver ficha - <strong><a href='<?= $enlace; ?>'>Ver aquí</a></strong>">
      </div>
    </div>
  </div>

  <div class="form-group text-center">
    <input type="submit" name="newEmail" value="Enviar" class="btn btn-primary">
  </div>
  <div class="form-group text-center">
    <?php
    if (isset($_GET['success'])) {
    ?>
      <div class="alert alert-success">
        E-mail enviado.
      </div>
    <?php
    } else if (isset($_GET['error'])) {
    ?>
      <div class="alert alert-danger">
        <!-- No se pudo enviar el e-mail. -->
        <?= $_GET['error_message']; ?>
      </div>
    <?php
    }
    ?>
  </div>
</form>
