<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>{{data.pUser.name}}'s Personal Recipes</title>
    <link
      rel="stylesheet"
      href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.4.1/semantic.min.css"
    />
  </head>
  
  <style>
    .vertical-center {
      margin: 0;
      position: absolute;
      top: 50%;
      -ms-transform: translateY(-50%);
      transform: translateY(-50%);
    }

    .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 inverted secondary 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 dropdown simple 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
          id="fridge_btn"
          style="display: flex;"
          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.pUser.image}}"
        />
        <div style="margin-left: 5px; margin-top: 75px;">
          <h2 style="color: bisque;">{{data.pUser.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 'public_profile'%}?id={{data.pUser.userID}}" class="item">
          About
        </a>
        <a href="{% url 'public_friends'%}?id={{data.pUser.userID}}" class="item">
          Friends
        </a>
        <a href="{% url 'public_fav_recipes'%}?id={{data.pUser.userID}}" class="item">
          Favorite Recipes
        </a>
        <a
          href="{% url 'public_personal_recipes'%}?id={{data.pUser.userID}}"
          class="active item"
        >
          Personal Recipes
        </a>
      </div>

      <div class="ui grid">

        <!--LIST ALL CURRENT USER RECIPES IF PRESENT-->
        <div class="eight wide column">
          <div style="margin-bottom: 50px;" class="ui raised segment">
            <h3>{{data.pUser.name}}'s Current Recipes</h3>
            <div class="ui list">
              {%if not data.my_recipes %}
              <label>{{no_rec}}</label>
              {%endif%} 
              {% for recipe in data.my_recipes %}
              <div class="item">
                <i class="right triangle icon"></i>
                <div class="content">
                  <a class="header" href="{% url 'recipe_view_page'%}?id={{recipe.recipe_id}}" id="rec_link" name="rec_link" value="True">{{recipe.recipe_name}}</a>
                  <div class="description">{{recipe.description}}</div>
                  <form
                    action="/empty_my_fridge/recipe_view_page/"
                    method="post"
                    class="ui form"
                  >
                     <span class="right floated star"/>

                      <input
                        style="display: none;"
                        name="go_public"
                        value="{{each}}"
                      />

                  </form>
                </div>
              </div>
              {%endfor%}
            </div>
          </div>
        </div>
      </div>
    </div>

    {% if data.message %}
    <script>
      document.getElementById("message").style.display = "block";
    </script>
    {% endif %}
    <!-- add code to list available personal recipes from database-->
  </body>
</html>
