{% extends 'app/base.html' %} {% load static %} {% block title %} Product
Details {% endblock title %} {% block content %} {% comment %}
<h1>Product Details {{pk}}</h1>
{% endcomment %} {% comment %}
<h1>{{product.title}}</h1>
{% endcomment %}

<div class="container">
  <div class="row flex justify-content-between">

    <div class="img2 col-lg-5 mt-5">
      <img
        src="{{product.product_image.url}}"
        alt="{{product}}"
        class="image col-xs-6 col-sm-12 col-lg-12 mt-3 text-sm-center w-100"
      />
    </div>

    <div class="productdetail col-lg-5 mt-5 pt-5">
      <h1>{{product.title}}</h1>
      <h4>
        Rs {{product.selling_price}}
        <small class="text-decoration-line-through text-muted fs-5">
          <del>Rs {{product.discount}}</del>
        </small>
      </h4>
        <br /><br />
        <div class="">
          <h3>Product Description</h3>
          <ul class="fs-5 list-unstyled">
            <li>
              <p class='paragraph'>{{product.description}}</p>
            </li>
          </ul>
        </div>


        {% if not request.user.is_superuser %}
        
        <form method="post" class="d-inline">
            {% csrf_token %}
            <input type="hidden" name="prod_id" value="{{product.id}}" />
            <button type="submit" class="btn btn-primary shadow px-5 py-2">
              Add to Cart
            </button>
          </form>
          
          {% if request.user.is_authenticated %}
        <span class=" wish">
          {% if wishlist %}
          <a href="{% url 'WishOrNot' product.id %}" class="btn btn-danger shadow px-5 py-2 ">Remove to Wishlist</a>
          {% else %}
          <a href="{% url 'WishOrNot' product.id %}" class="btn  wish shadow px-5 py-2 border-1">Add to Wishlist</a>
          {% endif %}
        </span>
        {% endif %}

        {% endif %}
     
  
    </div>
  </div>
</div>




{% endblock content %}

{% block JS %}

{% comment %} <script>

  $("body").bind("ajaxSend", function(elm, xhr, s){
    if (s.type == "POST") {
       xhr.setRequestHeader('X-CSRF-Token', getCSRFTokenValue());
    }
 });


  $(document).ready(function(){
    $(".wish").click(function(){

      $.ajax({
        type:"POST",
        url:"{% url 'ToWish' %}",
        data:{
        //  prod_id:id
        },
        success:function(data){
          console.log(data)
           // element.innerText = data.quantity
        }
      })

    });
  });
</script> {% endcomment %}

{% endblock JS %}



