<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Account Settings</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"
    />
  </head>
  <style>
    .ui.inverted.menu {
      background: #642b73; /* fallback for old browsers */
      background: -webkit-linear-gradient(
        to right,
        #c6426e,
        #642b73
      ); /* Chrome 10-25, Safari 5.1-6 */
      background: linear-gradient(
        to right,
        #c6426e,
        #642b73
      ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    }
    .ui.inverted.segment {
      background: #642b73; /* fallback for old browsers */
      background: -webkit-linear-gradient(
        to right,
        #c6426e,
        #642b73
      ); /* Chrome 10-25, Safari 5.1-6 */
      background: linear-gradient(
        to right,
        #c6426e,
        #642b73
      ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
    }
  </style>
  <body>
    {% csrf_token %}
    <!--Navigation Bar-->
    <div class="ui secondary inverted top fixed menu">
      <div class="item">
        <h3>Empty My Fridge</h3>
      </div>

      <a href="{% url 'home'%}" class="item">
        Home
      </a>
      <a href="{% url 'recipe_page'%}" class="item">
        Recipes
      </a>
      <div class="ui link simple dropdown item">
        <span class="text">Browse</span>
        <i class="dropdown icon"></i>
        <div class="menu inverted" style="margin-top: -1px;">
          <a class="item" href="{% url 'category' %}?category=breakfast">Breakfast</a>
          <a class="item" href="{% url 'category' %}?category=lunch">Lunch</a>
          <a class="item" href="{% url 'category' %}?category=dinner">Dinner</a>
          <a class="item" href="{% url 'category' %}?category=dessert">Dessert</a>
        </div>
      </div>

      <!--search and filter-->
      <div class="item">
        <form action="/empty_my_fridge/search_and_filter/" method="get" class="ui form">
          <div class="ui icon input">
            <input
              type="text"
              name="recipe_to_filter"
              placeholder="Search for recipes..."
            />
            <i class="search icon"></i>
          </div>
          <button class="ui button white">Go</button>
        </form>
      </div>
      <!--End of search and filter ui-->
      <div class="right menu">
        <a
        href="{% url 'fridge'%}"
        class="item"
      >
        My Fridge
      </a>
        <a href="{% url 'profile'%}" class="item active">
          <img
            id="image_profile"
            class="ui avatar image mini"
            src="{{data.user.image}}"
          />
          <p id="hi_name">{{data.user.name}}</p>
        </a>
        <a href="{% url 'logout'%}" class="item">
          Logout
        </a>
      </div>
    </div>
    <!--End of Navigation Bar-->

    <!--Profile Image-->

    <div class="ui segment inverted">
      <div style="margin-top: 70px; display: inline-flex;">
        <img
           id="user_image" style="height: 180px; width: 180px;"
          class="ui avatar image small"
          src="{{data.user.image}} "
        />
        <div style="margin-left: 5px; margin-top: 75px;">
          <h2 style="color: bisque;">{{data.user.name}}</h2>
        </div>
      </div>
    </div>

    <!--Container-->

    <div class="ui container" style="margin-top: 20px; margin-bottom: 250px;">
      <div class="ui pointing menu">
        <a href="{% url 'profile'%}" class="item">
          About Me
        </a>
        <a href="{% url 'friends'%}" class="item">
          Friends
        </a>
        <a
        href="{% url 'friend_requests'%}"
        class="item"
      >
        Friend Requests
      </a>
        <a href="{% url 'favorite_recipes'%}" class="item">
          My Favorite Recipes
        </a>
        <a href="{% url 'personal_recipes'%}" class="item">
          Personal Recipes
        </a>

        <div class="right menu">
          <a href="{% url 'edit_profile'%}" class="item">
            Edit Profile
          </a>
          <a
            href="{% url 'account_settings'%}"
            class="active item"
          >
            Account Settings
          </a>
        </div>
      </div>
      <div style="margin-bottom: 50px;" class="ui raised segment">
        <form action="/empty_my_fridge/recover_password/" method="post" class="ui form">
          <div style="width: 30%;" class="field">
            <label>Email</label>
            <input
              value="{{data.user.email}}"
              readonly=""
              name="email"
              type="email"
            />
          </div>
          <input style="display: none;" value="account_settings" name="activity" />
          <button class="ui button orange" type="submit">
            Change Password
          </button>
        </form>
        {% if data.admin %}
        <a href="{% url 'scrape_page'%}">
          <button onclick="startScrape()" style="margin-top: 10px; width: 150px;" class="ui button purple">
            Scrape
          </button>
          <p id="scrape"></p>
        </a>
        {% endif %}
        
        <div
          style="display: none;"
          id="message"
          class="ui {{data.msg_type}} message"
        >
          <div class="header">
            {{data.msg_type}}
          </div>
          <p>{{data.message}}</p>
        </div>
      </div>
    </div>

    {% if data.message %}
    <script>
      document.getElementById("message").style.display = "block";
    </script>
    {% endif %} 
    {% if data.user %}
    <script>
      function startScrape(){
        document.getElementById("scrape").innerHTML = "Scraping...Please wait"
      }
     
    </script>
    {% endif %}
  </body>
</html>
