<script type="text/javascript">
  function allowButton(btn) {
          var button = document.getElementById('sumbit-button');
          button.disabled = !btn.checked;
      }
</script>

<div class="container" style="margin-bottom: 300px">
  <div class="row mt-5">
    <div class="col-md-6 m-auto">
      <div class="card card-body">
        <h1 class="text-center mb-3">
          <i class="fas fa-user-plus"></i> Registeren
        </h1>
        <%- include ("./partials/messages"); %>
        <form action="/users/register" method="POST">
          <div class="form-group">
            <label for="username">Gebruikersnaam</label>
            <input
              type="name"
              id="username"
              name="username"
              class="form-control"
              placeholder="Voer uw gebruikersnaam in"
              value="<%= typeof username != 'undefined' ? username : '' %>"
            />
          </div>
          <div class="form-group">
            <label for="email">Email</label>
            <input
              type="email"
              id="email"
              name="email"
              class="form-control"
              placeholder="Voer uw Email in"
              value="<%= typeof email != 'undefined' ? email : '' %>"
            />
          </div>
          <div class="form-group">
            <label for="password">Wachtwoord</label>
            <input
              type="password"
              id="password"
              name="password"
              class="form-control"
              placeholder="Maak een wachtwoord"
              value="<%= typeof password != 'undefined' ? password : '' %>"
            />
          </div>
          <div class="form-group">
            <label for="password2">Wachtwoord bevestigen</label>
            <input
              type="password"
              id="password2"
              name="password2"
              class="form-control"
              placeholder="Wachtwoord bevestigen"
              value="<%= typeof password2 != 'undefined' ? password2 : '' %>"
            />
          </div>
          <label for="posts_checkbox" class="mt-2">
            <input type="checkbox" onclick="allowButton(this)" id="posts_checkbox" />
            Ik geef toestemming om mijn gegevens op te slaan
        </label>
          <button
            type="submit"
            class="btn btn-primary btn-block"
            style="background-color: #f99d03; border-color: #f99d03"
            id="sumbit-button"
            disabled
          >
            Registeren
          </button>
        </form>
        <p class="lead mt-4">
          Heb je een Account?
          <a href="/users/login" style="color: green">Login</a>
        </p>
      </div>
    </div>
  </div>
</div>
