<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
  <meta charset="UTF-8">
  <title>Alica - Offres</title>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
  <link rel="stylesheet" href="public/css/offres.css">
</head>
<body>
<header>
  {% include "menu.html" %}
</header>

<div class="container mt-4 d-flex align-content-center ">
  <div>
  <a href="?action=createOfferForm" type="button" class="btn btn-outline-success mb-4">Publier une offre</a>
  </div>

  <div class="container mt-4">

    <div class="d-flex flex-column align-items-center">
      <form action="?consultOffer" method="get" class="form-inline flex-wrap mb-4">
        <h2 class="mr-3">Filtrer les offres</h2>

        <div class="form-group mr-3 flex-column justify-content-left">
          <label for="typeContrat" class="text-left">Type de contrat :</label>
          <div class="form-check ml-0">
            <input class="form-check-input" type="radio" name="typeContrat" id="cdd" value="CDD" {% if typeContrat == "CDD" %}checked{% endif %}>
            <label class="form-check-label" for="cdd">CDD</label>
          </div>
          <div class="form-check ml-0">
            <input class="form-check-input" type="radio" name="typeContrat" id="cdi" value="CDI" {% if typeContrat == "CDI" %}checked{% endif %}>
            <label class="form-check-label" for="cdi">CDI</label>
          </div>
          <div class="form-check ml-0">
            <input class="form-check-input" type="radio" name="typeContrat" id="alternance" value="Alternance" {% if "Alternance" == typeContrat %}checked{% endif %}>
            <label class="form-check-label" for="alternance">Alternance</label>
          </div>
          <div class="form-check ml-0">
            <input class="form-check-input" type="radio" name="typeContrat" id="stage" value="Stage" {% if "Stage" == typeContrat %}checked{% endif %}>
            <label class="form-check-label" for="stage">Stage</label>
          </div>
        </div>



        <div class="form-group mr-3 flex-column">
          <label for="experience">Expérience :</label>
            <div class="form-check">
              <input class="form-check-input" type="radio" name="experience" id="junior" value="Junior" {% if "Junior" == experience %}checked{% endif %}>
              <label class="form-check-label" for="junior">Junior</label>
            </div>
            <div class="form-check">
              <input class="form-check-input" type="radio" name="experience" id="senior" value="Senior" {% if "Senior" == experience %}checked{% endif %}>
              <label class="form-check-label" for="senior">Senior</label>
            </div>
          </div>

        <div class="form-group flex-column">

        <label for="niveauEtudes">Niveau d'études :</label>
            <div class="form-check">
              <input class="form-check-input" type="radio" name="niveauEtudes" id="bac2" value="Bac+2" {% if "Bac+2" == niveauEtudes %}checked{% endif %}>
              <label class="form-check-label" for="bac2">Bac+2</label>
            </div>
            <div class="form-check">
              <input class="form-check-input" type="radio" name="niveauEtudes" id="bac3" value="Bac+3" {% if "Bac+3" == niveauEtudes %}checked{% endif %}>
              <label class="form-check-label" for="bac3">Bac+3</label>
            </div>
            <div class="form-check">
              <input class="form-check-input" type="radio" name="niveauEtudes" id="bac5" value="Bac+5" {% if "Bac+5" == niveauEtudes %}checked{% endif %}>
              <label class="form-check-label" for="bac5">Bac+5</label>
            </div>
          </div>
          <button type="submit" class="btn btn-primary">Filtrer</button>
        </form>
      </div>
    </div>

    <div>
    <a href="?action=consultOffers"  class="btn btn-info">Réinitialiser les filtres</a>
    </div>
</div>



  <h1 id="titrePrincipal">Offres d'emploi</h1>

{% if dVueErreur is defined %}
{% for value in dVueErreur %}
<p>{{value}}</p>
{% endfor %}
{% endif %}


<div class="col-md-8 offset-md-2">

  {% for offre in offres %}
  <article class="mb-4">
    <div class="row1">
      <img src="public/uploads/{{offre.getLogo()}}" class="img-fluid rounded" alt="logo"> <!-- Ajoutez la classe "rounded" pour arrondir les coins -->
      <h4>{{ offre.getNom() }}</h4>
    </div>
    <div class="row2">
    <p class="authorDate"><strong>Julien Martin | {{ offre.getDateStringFr()}}</strong></p>
    <p>{{ offre.getDescription() }}</p>
    </div>

    <div class="row3">
      <img src="public/assets/location.png" alt="location">
      <p>{{offre.getVille()}}</p>
    </div>
    <button type="button" class="btn btn-outline-primary btn-sm mb-2 custom-button"
            onclick="window.location.href = '?action=displayOffer&id={{offre.getId()}}';">En savoir plus >
    </button>
  </article>

  {% endfor %}

  <nav style="text-align: center;">
    <nav style="text-align: center;">
      {% if numberPages is defined %}
      {% if currentPage is defined %}
      {% for i in 1..numberPages %}
      {% if i == currentPage %}
      <!--
      index.php?action=consultOffers&page={{ i }}&typeContrat={{ typeContrat }}&experience={{ experience }}&niveauEtudes={{ niveauEtudes }}
      -->
      <a href="?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}" class="active bg-danger">{{ i }}</a>
      {% else %}
      <a href="?action=consultOffers&page={{ i }}&{{valContrat}}{{valExp}}{{ValEtudes}}">{{ i }}</a>
      {% endif %}
      {% endfor %}
      {% endif %}
      {% endif %}
    </nav>

  </nav>
</div>






<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>