{% extends 'app/base.html' %} {% block title %} Checkout {% endblock %} {% block content %}
<div class="container">
  {% if messages %} {% for msssage in messages %}
  <div class="alert alert-danger" role="alert">{{ message }}</div>
  {% endfor %} {% endif %}
  <div class="row mt-5">
    <div class="col-sm-6">
      <h4>Order Summary</h4>
      <hr />

      {% for item in cart_items %}
      <div class="card mb-2">
  <div class="card-body">
          <h5>Product: {{item.product.title}}</h5>
          <p>Quantity: {{item.quantity}}</p>
          <p class="fw-bold">Price: {{item.product.selling_price}}</p>
        </div>
      </div>
      {% endfor %}
      <p class="fw-bold">Total Cost + Rs. 60 = {{totalAmount}}</p>
      <small
        >Term and Condition: Lorem ipsum dolor sit amet consectetur adipisicing
        elit. Maiores temporibus rerum, illum dolorem distinctio recusandae
        impedit, sunt quis ut dolorum necessitatibus. Repudiandae rerum quas,
        ipsam magnam debitis voluptates corrupti molestias!</small
      >
    </div>
    <div class="col-sm-4 offset-sm-1">
      <h4>Select Shoipping Address</h4>
      <hr />
      <form method="post" id="myform">
        {% csrf_token %} {% for address in Address %}
        <div class="card mb-1">
          <div class="card-body">
            <h5 >{{address.name}}</h5>
          <p>Mobile : {{address.mobile}}</p>
          <p>{{address.locality}} {{address.city}} {{address.state}} - {{address.zipcode}}</p>

          <div class="form-check my-2">
            <input
              type="radio"
              name="custid"
              id="custadd{{forloop.counter}}"
              value="{{address.id}}"
              class="form-check-input"
            />
            <label
              for="custadd{{forloop.counter}}"
              class="form-check-label fw-bold"
              >Address:{{forloop.counter}}</label
            >
          </div>
          </div>
        </div>
        {% endfor %}
        <div class="mb-3">
          <label for="totalamount" class="form-label">Total Amount</label>
          <input
            type="text"
            name="totalamount"
            value="{{totalAmount}}"
            class="form-control"
            role='button'
            readonly
          />
        </div>
        <div class="text-end">
          <button type="submit" class="btn btn-success mt-3 px-5 fw-bold">
            {% comment %} Continue {% endcomment %}
            Place Order
          </button>
          {% comment %} <a href="{% url 'payment' %}" class="btn btn-success mt-3 px-5 fw-bold">Place Order</a> {% endcomment %}
          {% comment %}
          <div id="paypal-button-container"></div>
          <button
            type="submit"
            class="btn btn-warning mt-3 px-5 fw-boold"
            id="rzp-button1"
          >
            Payment
          </button>
          {% endcomment %}
        </div>
      </form>
    </div>
  </div>
</div>
{% endblock %}
