<%- include("../includes/header.ejs", {title: "Edit " + server.name}) %>
<!-- create form -->
<div class="container-sm p-10">
  <a href="/server/<%= server.id %>/analytics" 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">
    <i class="fas fa-chart-bar"></i>
    <span>Analytics</span>
  </a>
  <br><br>
  <form method="post" action="">
    <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"><%= server.long_description %></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" 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 value="<%= server.description %>" />
      <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">
      <input type="text" name="server_webhook" 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=" " value="<%= server.webhook %>" />
      <label for="server_webhook" 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">Discord WebHook to recieve votes.</label>
    </div>
    <div class="relative z-0 mb-6 w-full group">
      <input type="text" name="server_vanity" id="server_vanity" 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=" " value="<%= server.vanity %>" />
      <label for="server_vanity" 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">Fill this in to get a vanity url invite.</label>
      <span class="text-white text-xs" id="vanity">https://botscord.xyz/i/</span>
    </div>
    <script>
      var vanity = document.getElementById("vanity");
      vanity.innerHTML = vanity.innerHTML + "<%= server.vanity %>";
      var change = document.getElementById("server_vanity");
      change.addEventListener("keyup", function() {
        vanity.innerHTML = "https://botscord.xyz/i/" + change.value;
      });
    </script>
    <div class="relative z-0 mb-6 w-full group">
      <select multiple name="tags" class="bg-gray-50 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>
        <% global.config.server.tags.forEach(function(tag) { %>
        <option value="<%= tag %>" <% if (server.tags.includes(tag)) { %>selected<% } %>><%= tag %></option>
        <% }) %>
      </select>
    </div><br>
    <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">Update</button>
  </form>
  <br>
  <!-- show code for banner -->
  <span class="text-white">Add this code to your websites to get automatically a banner</span>
  <textarea class="text-white" style="width:100%;" rows="2" disabled>
    <img src="https://botscord.xyz/api/v1/server/banner/<%= server.id %>">
  </textarea>
</div>