<!-- add servers for the website -->
<%- include('../includes/header.ejs', {title: 'Add server' }) %>
<!-- create form -->
<div class="container-sm p-10">
  <form method="post" action="">
    <div class="relative z-0 mb-6 w-full group">
      <select name="serverid" class="bg-gray-700 border border-gray-300 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" required>
        <% for (var i=0; i < user.guilds.length; i++) { %>
        <option value="<%= user.guilds[i].id %>">
          <%= user.guilds[i].name %>
        </option>
        <% } %>
      </select>
    </div>
    <div class="relative z-0 mb-6 w-full group">
      <textarea type="text" name="server_description" id="server_name" class="block py-2.5 px-0 w-full text-sm text-white bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required rows="5"></textarea>
      <label for="server_name" class="peer-focus:font-medium absolute text-sm text-white dark:text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Server
        description</label>
    </div>
    <div class="relative z-0 mb-6 w-full group">
      <input type="text" name="server_short" maxlength="100" id="floating_last_name" class="block py-2.5 px-0 w-full text-sm text-white bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required />
      <label for="server_name" class="peer-focus:font-medium absolute text-sm text-white dark:text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Short
        Description (Will be show on home page)</label>
    </div>
    <div class="relative z-0 mb-6 w-full group">
      <select multiple name="tags" class="bg-gray-700 border border-gray-300 text-white text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" required>
        <% var tags = global.config.server.tags %>
        <% tags.forEach(function(tag) { %>
        <option value="<%= tag %>">
          <%= tag %>
        </option>
        <% }) %>
      </select>
    </div>
    <!-- invite link -->
    <div class="relative z-0 mb-6 w-full group ">
      <input type="text" name="server_invite" id="invite" class="block py-2.5 px-0 w-full text-sm text-white bg-transparent border-0 border-b-2 border-gray-300 appearance-none dark:text-white dark:border-gray-600 dark:focus:border-blue-500 focus:outline-none focus:ring-0 focus:border-blue-600 peer" placeholder=" " required />
      <label for="invite" class="peer-focus:font-medium absolute text-sm text-white dark:text-white duration-300 transform -translate-y-6 scale-75 top-3 -z-10 origin-[0] peer-focus:left-0 peer-focus:text-blue-600 peer-focus:dark:text-blue-500 peer-placeholder-shown:scale-100 peer-placeholder-shown:translate-y-0 peer-focus:scale-75 peer-focus:-translate-y-6">Invite Link</label>
      <br>
      <input type="checkbox" class="w-4 h-4 text-blue-600 bg-gray-700 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600" name="create" id="create">
      <label for="default-checkbox" class="ml-2 text-sm font-medium text-white dark:text-gray-300">Create one for me</label>
    </div>
    <script>
      const check = document.getElementById('create');
      check.addEventListener('change', function() {
        if (check.checked) {
          document.getElementById('invite').disabled = true;
          document.getElementById('invite').value = '';
        } else {
          document.getElementById('invite').disabled = false;
        }
      });
    </script>
    <div class="relative z-0 mb-6 w-full group">
      <label for="tos" class="ml-2 text-sm font-medium text-white dark:text-gray-300">Be adding a server you automatically to our <a href="/tos" target="_blank" class="text-blue-700 hover:text-blue-300">Terms of Service</a> and <a href="/privacy" target="_blank" class="text-blue-700 hover:text-blue-300">Privacy Policy</a></label>
    </div>
    <button type="submit" class="text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800">Submit</button>
  </form>
</div>